Preheat your oven to 350°F (175°C).
In a large skillet, melt the butter and olive oil over medium heat. Add the sliced onions, stirring frequently. Cook the onions for about 25 minutes until they become golden brown and caramelized.
During the last 5 minutes of cooking the onions, sprinkle in the sugar to enhance their sweetness.
Add the beef broth, heavy cream, thyme, salt, and pepper to the skillet. Stir well to combine and bring to a simmer. Cook for another 5 minutes.
In a mixing bowl, layer half of the baguette slices. Pour half of the onion and broth mixture over the bread. Sprinkle half of the Gruyère cheese and half of the Parmesan cheese over the top.
Repeat the layering process with the remaining baguette slices, onion mixture, and cheeses.
Place the casserole dish in the preheated oven and bake for 30 minutes, until the cheese is melted and bubbly and the top is golden brown.
Remove from the oven and let cool for a few minutes before serving.