Add the potatoes to a large saucepan of boiling water, bring back to the boil, then cook for 3–4 minutes until only just tender. Tip into a colander and drain well.
Heat the butter in a frying pan, add the shallots and garlic and fry for 4–5 minutes until softened and just turning golden. Fork the cream, egg yolk, herbs, nutmeg and a generous amount of salt and pepper together.
Cut the pastry into 4 then roll out each piece thinly on a lightly floured surface to a rough 20 cm (8 inch) circle. Use to line 4 buttered individual 10 cm (4 inch) springform tins, leaving the excess pastry hanging over the sides.
Divide half the potatoes between the tins, top with the fried shallots, cheese and the rest of the potatoes. Cover with the cream mix, squeeze the ends of the pastry together to enclose the filling, trimming off any excess, and brush the edges with beaten egg to stick together.
Brush the tops with beaten egg, add a slice of shallot on top and sprinkle with thyme leaves, salt and pepper. Bake in a preheated oven, 200°C (400°F), Gas Mark 6, for 30–35 minutes. Check after 20 minutes and cover with foil if the pastry is browning too quickly.
Stand for 5 minutes, loosen the edges with a knife, remove the tins and serve hot with a rocket and bacon salad.