Preheat your oven to 375°F (190°C).
In a mixing bowl, combine the heavy cream, milk, garlic powder, onion powder, salt, black pepper, and thyme. Whisk together until well mixed.
In the prepared baking dish, arrange a layer of the sliced sweet potatoes, slightly overlapping them.
Pour a portion of the cream mixture over the first layer of sweet potatoes, then sprinkle with a layer of shredded cheddar cheese.
Repeat the layering process until you’ve used all the sweet potatoes, finishing with a layer of the cream mixture and the remaining shredded cheese on top.
Sprinkle the grated Parmesan cheese over the final layer for added flavor.
Cover the baking dish with aluminum foil and bake in the preheated oven for 30 minutes.
After 30 minutes, remove the foil and bake for an additional 20 minutes, or until the top is golden and bubbly and the sweet potatoes are tender.
Allow the gratin to cool for about 10 minutes before serving to set up a bit.