Cook the pasta according to package instructions in a large pot of salted boiling water until al dente. Drain and set aside.
In a large skillet, heat the olive oil and butter over medium heat. Add the sliced onions and stir to coat them.
Cook the onions slowly, stirring occasionally for about 20 minutes, until they are caramelized and golden brown. If they begin to stick to the pan, you can add a splash of broth.
Add the sugar, thyme, salt, and pepper, and cook for another 2 minutes to enhance the flavor.
Pour in the beef broth and bring to a simmer. Let it cook for about 5-10 minutes to allow the flavors to meld.
Add the cooked pasta to the skillet, tossing to combine with the onion and broth mixture.
In a baking dish or oven-safe skillet, layer the pasta and onion mixture. Sprinkle the Gruyère and Parmesan cheese evenly on top.
Broil in the oven for about 5 minutes, or until the cheese is melted and bubbly. Watch closely to avoid burning.
Remove from the oven, let cool for a minute, and serve warm.