Reserve the potatoes in cold salted water. Melt the butter and sauté the mushrooms with the garlic until just turning colour. Do not overcook. Drain the mushrooms, reserving the liquid.
With a fork, mash the two cheeses together. Drain the potatoes and dry them well.
Butter a 9-inch pie dish and put a layer of potatoes at the bottom, then half the mushrooms. Spoon over some of the mushroom liquid and then spread the cheese mixture on top. Follow with another layer of mushrooms and lastly the potatoes. Season as you go and finish by pouring any remains of the mushroom liquid over the whole.
Cover with wet greaseproof paper and bake at gas mark 7/425°F/220°C for 45 minutes.