Source: bonappétit.com, Claire Saffitz, November 2015
5 garlic cloves, divided
1 tablespoon unsalted butter, room temperature
2 medium shallots, quartered through root ends
2½ cups heavy cream
1 tablespoon kosher salt
1 teaspoon freshly ground black pepper
1 tablespoon thyme leaves, plus more
4 pounds potatoes, scrubbed, very thinly sliced on a mandoline
3 ounces Gruyère, finely grated
1 ounce Parmesan, finely grated
Arrange potato slices in prepared dish, fanning out a handful at a time and placing in dish at an angle (this ensures every scoop will have tender potatoes from the bottom and crisp edges from the top). Shingle as you work until bottom of dish is covered. Tuck smaller slices into any gaps to fill. Pour cream mixture over potatoes and cover dish tightly with foil. Bake potatoes until tender and creamy, 60–75 minutes. Let cool.
Place rack in highest position; heat broiler. Remove foil and top potatoes with Gruyère and Parmesan. Broil until cheese is bubbling and top of gratin is golden brown, 5–10 minutes. Serve topped with more thyme leaves.
Do Ahead: Gratin can be baked 1 day ahead. Cover and chill. Bring to room temperature before broiling.