For the caramelized onions
Heat a large heavy-bottomed pot over medium-high heat. Add the butter and olive oil. Add in the onions and toss to coat. Season with salt and pepper, spread the onions in an even layer, cover the pot and lower the heat to medium-low. Let the onions sweat, steam and soften for 10 to 15 minutes. Uncover the pan and let the onions cook for about 1 hour, checking on the onions frequently and stirring.
Once the onions are fully caramelized and a deep golden color, add the sherry and scrape up the bits from the bottom of the pan. Stir in the thyme, season with salt and pepper and set aside.
For the sandwich build:
Preheat a griddle to medium-high heat. Build the sandwiches with 1 slice of gruyere on the bottom of 1 piece of bread, some caramelized onions in the middle and another slice of gruyere on top. Top with another slice of bread. Repeat to make 3 more sandwiches.
Butter both sides of the sandwiches and place on the griddle. Cover with a metal bowl and cook for 3 to 4 minutes. Flip the sandwiches, cover again with the metal bowl and cook until the cheese is melted and the sandwiches are crisp, another 3 to 4 minutes.