Thinly slice the yellow onions into uniform half-moons.
In a heavy-bottomed pot or Dutch oven, melt the ghee over medium-low heat.
Add the onions to the pot and cook slowly, stirring occasionally, for 30 to 40 minutes until they are deeply caramelized and dark golden brown.
Season the onions with sea salt, black pepper, and fresh thyme leaves.
Pour in the dry sherry to deglaze the pan, scraping up all the flavorful brown bits from the bottom.
Add the beef bone broth and bring the mixture to a gentle simmer for 15 minutes to allow the flavors to meld.
While the soup simmers, lightly toast the sourdough bread slice until crisp.
Ladle the soup into an oven-safe crock or bowl, place the toasted bread on top, and cover with the shredded Gruyère cheese.
Place the bowl under a broiler for 2 to 3 minutes until the cheese is melted, bubbly, and slightly browned.