To make the crust, in a bowl, combine flour, salt, thyme, and rosemary. Add butter and work it into flour with pastry cutter or pulse in a food processor until mixture resembles fresh breadcrumbs. Combine water, egg, and vinegar. Add to flour mixture and mix until dough sticks together. Form dough into a ball and flatten to form a disk.
Lightly flour a work surface and roll dough disk between 2 sheets of waxed paper until 1/8” thick and 15” in diameter. Transfer crust to an 8” spring form pan. Flatten bottom and fold dough edges under at pan edge. Refrigerate for 30 minutes.
Preheat oven to 425°. Line a rimmed baking sheet with heavy duty aluminum foil.
Meanwhile, peel potatoes and slice to 1/4″ thickness.
In a small saucepan over medium heat, add a drizzle of oil. Add shallots and cook until translucent, about 5 minutes. Add garlic and cook until fragrant, about 1 minute. Transfer to a plate. Add cream, thyme, rosemary, and nutmeg into same pan and warm until wisps of steam appear.
Remove crust from fridge and brush bottom and sides lightly with egg. In a small bowl, combine cheeses.
Layer one-third each of Yukon gold potatoes, sweet potatoes, and sprinkle with salt and pepper in crust. Spread 1/3 of shallot-garlic mixture over potatoes. Sprinkle 1/3 of cheese mixture over shallot-garlic mixture. Pour 1/3 herbed cream mixture over shallot-garlic mixture. Repeat layers twice, pressing layers down slightly to fit. Place on prepared baking sheet. Cover pan with heavy-duty aluminum foil.
Bake for 15 minutes, lower oven temperature to 375° and bake for 1/2 hour. Uncover, brush edges with egg wash, and bake until potatoes are done and crust is browned, 30-45 minutes. Remove from oven and let sit 15-20 minutes. Place paper towels around pan to soak up any oil.
Carefully transfer to a serving plate and remove sides of pan. Carefully slide gratin off bottom of pan using a long knife or narrow spatula. Garnish with thyme sprigs.
Tip: Make 1 to 2 days ahead of time. To reheat, preheat oven to 350°, bake, covered, for 30-45 minutes or until bubbling.