Preheat the oven to 180°C, 350°F, Gas 4.
Slice the waxy potatoes as thick as pound coins. Slice the mushrooms thickly. Grease a baking dish with the butter then layer the potatoes and mushrooms alternately, scattering the onions and dotting each layer with a little butter and seasoning and sprinkling over thyme leaves as you go and finishing with a layer of potatoes.
Pour over the stock until it comes level with the top of the potatoes. Cover the top with grated cheese and bake in the oven for around 30-40 minutes until the potatoes are completely tender to the point of a knife. If the top starts to brown too much during cooking, cover with foil.