Melt 4 tablespoons of butter in a large pan over medium-high heat.
Meanwhile, cut the top and the bottoms off of your yellow onions and slice 1/4 of an inch thick. Keeping the onions uniformed in thickness will help them cook evenly.
When the butter has melted, add in the onions, garlic, thyme, kosher salt and pepper. Toss until coated in the butter. Cover and cook undisturbed for 5 minutes.
After the 5 minutes, uncover and cook on medium-low heat for 40 minutes, stirring every 5 minutes until the onions are soft and a deep golden in color.
Pour in the wine and scrape any bits that accumulate on the bottom of the pot and then remove the pot off of the heat.
Build your sandwiches by topping the sourdough slices with grated gruyere, caramelizd onions and more gruyere. Lastly, place the second slice of bread on top.
Preheat your griddle to 250° melt 1 tablespoon of butter per sandwich, spreading it around in pools roughly the size of your sandwiches.
Place the sandwiches down and increase the temperature of your griddle to 300°. Gently pressing the sandwich into the butter.
Griddle the sandwiches until the underside is crisp and a deep golden brown.
Before flipping, use a spatula to lift the sandwich, melt another tablespoon of butter on the griddle (as you did before) and carefully flip the sandiwch on the second side. Gently pressing the sandwich into the butter.
Once the cheese is melted and the second side is crisp and golden, transfer to a cutting board and slice the sandwiches in half and serve.