In a large shallow oven-safe skillet over medium heat, melt the butter. Add the onions and toss to coat. Cook, stirring occasionally, until softened, 8-10 minutes.
Meanwhile, cut the bread into 1-inch cubes. Spread on a half sheet pan and bake for 10-15 minutes until dry and slightly crisp. Set aside. Turn the oven up to 375 degrees.
When the onions are soft, add the thyme and season with salt and pepper. Continue cooking, stirring occasionally, until golden brown, 30-40 minutes. If the onions dry out, add 1-2 tablespoons of water as needed.
Stir in Worcestershire sauce and vinegar. Taste and season with salt and pepper as needed. Stir in bread and toss together.
Add the beef broth and stir to combine. The bread should be moist but not soupy. Add more broth if needed.
Add half of Gruyere cheese and fold together. Top with the remaining cheese.
Bake at 375 for 20-25 minutes until golden brown on top. Serve.
Use freshly shredded cheese for the best flavor and melting quality.
Don't rush the onions. It takes time - and a little patience - to develop the sweet caramelization.
To make ahead: caramelize the onions up to 2-3 days in advance and store in the refrigerator. Toast the bread cubes up to 2-3 days in advance and store them in an airtight container. Combine the ingredients and bake according to the directions.