In a large skillet, cook onion and leek in butter over medium-low heat until soft and lightly golden. Add half of the garlic and cook for 2 to 3 more minutes.
In a small saucepan, heat cream, milk, remaining garlic, bay leaf, thyme, 1 tsp salt, and pepper for 5 minutes over low heat to infuse. Remove herbs and set aside.
Toss potato slices with the leek mixture and season with 1/2 tsp salt and a pinch of nutmeg.
Butter a small casserole dish. Layer potatoes in a slightly staggered way to create spaces for the cream to seep in. Make sure you fill the whole casserole dish so the potatoes completely fill it. (see note)
Pour the warm cream mixture over the potatoes. Sprinkle with half of the Gruyère and cover with foil.
Bake at 325°F for 75 to 90 minutes, or until potatoes are tender.
Uncover, top with remaining Gruyère and grated Parmesan, and broil until golden and bubbly.
Let rest for 10 to 15 minutes before serving.