Heat butter and olive oil in a large skillet over medium heat. Add sliced onions and cook for 20–25 minutes, stirring occasionally, until golden brown and soft. Add sugar if desired to enhance sweetness.
Wash and slice Yukon Gold potatoes into ¼-inch rounds for even cooking.
Preheat oven to 375°F (190°C) and lightly grease a baking dish with butter or cooking spray.
Arrange half of the potatoes in the dish, followed by half of the caramelized onions and half of the shredded cheese. Repeat with remaining ingredients.
In a bowl, whisk together cream, broth, garlic powder, salt, pepper, and thyme. Pour evenly over the layered potatoes and onions.
Cover with foil and bake for 45 minutes. Remove foil and continue baking for another 15 minutes, until the top is golden brown and bubbling.
Let the casserole rest for 5 minutes before serving. Garnish with fresh thyme and, if desired, a sprinkle of parmesan or crispy fried onions.