Melt butter in a skillet over medium heat. Add onions and sugar. Cook for 20–25 minutes until jammy and dark gold. Add garlic and thyme for the last 2 minutes. Divide onions into two piles.
Boil shells for 2 minutes less than the package says (so if it says 9 minutes, do 7). Drain and rinse.
Combine Ricotta, egg, half of the onions, Parmesan, and 1/2 cup of Gruyère.
In the onion skillet, whisk flour into the remaining onions. Slowly add beef broth and Worcestershire. Simmer until thickened, then stir in heavy cream.
Spread 1/2 cup of sauce in a 9x13 dish. Stuff shells with the ricotta mix and line them up. Pour remaining sauce over the top and sprinkle with the rest of the Gruyère.
Cover with foil and bake at 375°F (190°C) for 15 minutes.
Remove foil. Sprinkle your crispy fried onions (or buttered breadcrumbs) over the top.
Bake uncovered for another 5–10 minutes until the topping is toasted and the cheese is bubbling.