Preheat the oven to 180C / 355F and butter a medium-sized baking dish.
Place the cream, milk, garlic, nutmeg (if using) and thyme in a medium saucepan and heat to a simmer. Add the potato and onion slices, put a lid on the saucepan and simmer for 10 minutes, until the potatoes are just tender. Give them a good stir after half the cooking time.
Remove the thyme sprigs, then tip half of the potato mixture into the baking dish. Grind over plenty of salt and pepper and sprinkle over about a third of the cheese.
Tip the rest of the potato mixture and cream/milk into the dish, smoothing out the top a little, then sprinkle over the rest of the cheese. Grind over a bit more pepper (if you like), then sprinkle over a little more fresh thyme.
Bake for 25 to 30 minutes until golden and bubbling.
You can assemble this dish ahead of time, and cook later. Just assemble to the end of step 4, then cover and refrigerate until ready to bake.Leftovers reheat pretty well, either in the oven or microwave.