Preheat the oven to 375°F. Rub the butter all over the inside of a 10-inch cast iron skillet, or similarly sized dish.
Scrub and peel the sweet potatoes. Slice into 1/8-inch thick rounds (a mandoline is the best way to do this). If you are using different colors, keep the colors separate.
Starting at the outer edge of the skillet, stand the slices up on their edges, then shingle them around the perimeter of the pan like fallen dominoes to create a ring (if using different colors, add the sweet potatoes in alternating color blocks). Repeat, adding another ring inside the first. Continue until the skillet is full.
In a small saucepan, warm the cream with the thyme, garlic, salt, nutmeg, and pepper. Heat until the cream steams and small bubbles form all around the edges, whisking often. Remove from the heat and stir in ¼ cup Gruyère and ¼ cup Parmesan.
Sprinkle the potatoes with ¼ cup Gruyère, then pour the cream mixture over the top, drizzling it slowly and evenly over the surface area. Top with the remaining ¼ cup Gruyère and 2 tablespoons Parmesan.
Cover the pan tightly with foil and bake 35 minutes. Uncover, then bake 18 to 20 minutes more, until the sweet potatoes are fork-tender, the cream has thickened, and the top is golden and crisp at the edges. If desired, pop the pan under the broiler for a few minutes to further brown the cheese.
Sprinkle with additional fresh thyme. Let the gratin rest 10 minutes before serving.
Notes
TO STORE: Refrigerate leftover Sweet Potato Gratin in an airtight container for up to 4 days. (I don't recommend freezing this gratin. Cream-based sauces can separate after thawing, and the sweet potatoes may become mushy.)
TO REHEAT: Cover with foil and warm in a 350°F oven until heated through. Remove the foil toward the end if you'd like to crisp the top again.