Preheat oven to 375°F (190°C). Lightly grease an 8x8 inch baking dish with butter or cooking spray.
In a large skillet, melt 2 tablespoons butter with olive oil over medium heat. Add sliced onions and cook slowly, stirring occasionally, for 20-25 minutes until deeply golden and soft. Add 1/2 teaspoon salt and 1/4 teaspoon pepper during last 5 minutes. Set aside.
Whisk together beef broth, heavy cream, Dijon mustard, minced garlic, remaining salt, and remaining pepper in a bowl.
Arrange half the potatoes in prepared dish, overlapping slightly. Top with half the caramelized onions and half the Gruyère cheese. Pour half the cream mixture evenly over layers.
Repeat with remaining potatoes, onions, and Gruyère. Finish with remaining cream mixture.
Cover tightly with aluminum foil and bake for 45 minutes.
Remove foil, sprinkle Parmesan cheese on top, and bake uncovered another 15-20 minutes until potatoes are fork-tender and top is golden and bubbly.
Let rest 10 minutes before serving. Garnish with fresh thyme if desired.