Peel your potatoes if you like a smoother texture, then slice them as thinly and evenly as possible — about 1/8-inch thick works best. I use a mandoline for this because uneven slices mean uneven cooking, and you want every piece tender at the same time.
In a small saucepan, combine the cream, milk, garlic, thyme, salt, pepper, and nutmeg. Warm it gently over low heat for about 5 minutes, just until it's fragrant and slightly steaming. Don't let it boil, or the cream can split.
Rub the butter generously across the bottom and sides of your baking dish. This little step keeps the bottom layer of potatoes from sticking and makes serving so much easier later.
Arrange a layer of potato slices in the dish, slightly overlapping like shingles. Scatter a few onion slices over the top, then repeat until you've used about two-thirds of your potatoes and onions.
Slowly pour the warm cream mixture over the potatoes, letting it seep down between the layers. Give the dish a gentle shake so the cream distributes evenly instead of pooling on top.
Top with your last layer of potatoes and onions, pressing down gently so everything sits snugly together. This keeps the gratin from looking messy once it's baked and sliced.
Cover the dish tightly with foil and bake at 375°F (190°C) for 45 minutes. The foil traps steam, which helps the potatoes soften evenly all the way through.
Remove the foil, lay your brie slices across the top, and return the dish to the oven uncovered for another 25–30 minutes, until the cheese is molten and the top is golden.
Let the gratin sit for 10 minutes once it's out of the oven. This allows the cream to thicken slightly so your slices hold together instead of sliding apart.