Caramelize Onions: In a large heavy pot such as a Dutch oven, add the olive oil and 2 tbsp of butter. Cook on medium until butter melts. Add the onions and give them a stir to coat them in the oil. Cover the pot with a lid and cook for 20 minutes with the heat still on medium, stirring every few minutes. After 20 minutes the onions should be transparent.
Remove the lid and stir in the sugar and salt. Continue cooking for another 40 minutes, stirring occasionally. The onions are done when they are a deep golden color and sweet.
Make a Roux: Add the flour, and remaining 1 tbsp of butter and stir. Cook for about 2 or 3 minutes, just enough to cook the flour and remove that flour taste.
Deglaze: Add 1 cup of the beef broth to the pot and stir. Cook for about 1 minute while stirring to scrape the bottom of the pot. You'll see it evaporate almost immediately.
Add broth, wine and herbs: Add the rest of the broth to the pot, followed by the red wine, bay leaves and thyme sprigs.
Simmer: Bring to a boil, then turn down the heat and simmer for 30 minutes, uncovered.
Season and add cognac: Taste for seasoning and adjust with salt and pepper if needed. Stir in the cognac.
Add bread and cheese: Top the soup with about 1 cup of gruyere cheese. Add the slices of bread over the cheese. I prefer to toast my bread first then add it to the soup. To toast the bread, lightly sprinkle the bread slices with some olive oil, transfer them to a baking sheet and toast them under broil for about 30 seconds to a minute per side. Top the soup with toasted bread, then top with remaining gruyere and parmesan cheese.
Melt cheese: Preheat your oven to 350 F degrees. Transfer the pot to the oven and bake until the cheese melts and starts to brown, about 20 to 25 minutes. Ladle into bowls and serve.