In a large skillet over medium heat, cook the pancetta until golden brown. Toss it around occasionally so it doesn't burn.
Use a slotted spoon to remove the pancetta from the pan and place over a plate covered with paper towels. This soaks in any leftover grease that's on the pancetta. Set aside for later.
In a medium saucepan over medium heat, melt the butter. Once melted, whisk in the flour until incorporated.
While whisking, gradually add the cream until smooth. Then mix in the garlic, thyme, nutmeg, and salt and pepper. Bring to a simmer.
Meanwhile, preheat the oven to 400°F (205°C) and slice the potatoes using a mandoline.
In a 9x13-inch (23x33 cm) baking dish, place a light layer of the cream mixture on the bottom. Arrange a single layer of potatoes on top, overlapping them just slightly. Add some of the leeks and pancetta on top followed by some of the cream and gruyere cheese.
Repeat the process until you have about 3 layers of potatoes. Be sure to reserve enough cream and cheese for the top.
Cover the dish with foil and bake for 50 minutes.
Remove the foil and bake for another 25 minutes or until the potatoes are tender and the top is golden brown. It will be very bubbly around the edges so let it sit for a few minutes before serving.
Top with fresh thyme and serve warm.