Preheat your oven to 350°F (175°C).
Cook the pasta according to package instructions until al dente. Drain and set aside.
In a large skillet, heat the olive oil over medium heat. Add the sliced onions, sugar, and salt. Cook, stirring occasionally, for about 15-20 minutes until the onions are caramelized and golden brown.
Stir in the minced garlic, thyme, and black pepper. Cook for an additional 1-2 minutes until fragrant.
Pour in the beef broth and heavy cream, stirring to combine. Bring the mixture to a simmer and let it cook for about 5 minutes until slightly thickened.
In a large mixing bowl, combine the cooked pasta with the onion mixture. Stir in half of the Gruyère cheese and half of the mozzarella cheese.
Transfer the pasta mixture to a greased 9x13-inch baking dish. Top with the remaining Gruyère, mozzarella, and Parmesan cheese.
Bake in the preheated oven for 25-30 minutes, or until the cheese is bubbly and golden brown.
Remove from the oven and let it cool for a few minutes. Garnish with chopped parsley before serving.