Cook the pasta according to package instructions until al dente. Drain and set aside, reserving 1/2 cup of pasta water.
In a large skillet, heat the olive oil over medium heat. Add the sliced onions and cook, stirring occasionally, for about 15-20 minutes until they are caramelized and golden brown.
Stir in the minced garlic, sugar, salt, pepper, and thyme. Cook for an additional 2 minutes until fragrant.
Pour in the beef broth and scrape the bottom of the skillet to deglaze. Let it simmer for 3-4 minutes until slightly reduced.
Lower the heat and stir in the heavy cream. Gradually add the Gruyère cheese and Parmesan cheese, stirring until melted and smooth.
Add the cooked pasta to the sauce, tossing to coat. If the sauce is too thick, add reserved pasta water a little at a time until desired consistency is reached.
Serve immediately, garnished with chopped parsley.