In a skillet, heat the butter and olive oil over medium heat. Add the sliced onions, sugar, and salt. Cook for about 15 minutes until the onions are soft and caramelized, stirring occasionally.
Once caramelized, sprinkle the flour over the onions and stir to combine. Slowly add the beef broth, stir well, and let simmer for about 5 minutes until slightly thickened. Remove from heat.
While the onions cook, shape the ground beef into four patties and season with black pepper.
Preheat your grill or grill pan over medium-high heat. Grill the patties for about 4-5 minutes per side for medium doneness.
In the last minute of cooking, place a slice of Gruyère cheese on each patty and close the grill lid to melt the cheese.
Toast the burger buns on the grill for about 1-2 minutes until golden.
Assemble the burgers: place each patty on the bottom half of the bun, generously top with caramelized onions, and add the top half of the bun.
Garnish with fresh thyme leaves if desired, and serve hot.