Preheat the oven to 375℉. Lightly grease a 24-cavity mini muffin pan. Set aside.
Heat a large sauté pan over medium heat, add the butter and allow to melt. Add in onions and quickly toss to separate the slices. Sauté, stirring occasionally, until the onions are soft and start to brown. Sprinkle sugar and black pepper over the onions. If onions begin to cook too quickly, lower heat to medium-low. They will be tender and caramelized when done, roughly 25 to 30 minutes. Stir in the dry sherry or red wine vinegar and remove from the heat. Set aside in a small bowl.
While onions are cooking, lightly flour a clean work surface and roll out your thawed puff pastry sheet to flatten it slightly. Carefully use a knife to cut your puff pastry into 24 equal small squares.
Press a square of the puff pastry into each cavity of the mini muffin baking pan. Top each puff pastry square with a tablespoon of caramelized onions.
Top each with a sprinkle of shredded gruyere cheese or Swiss cheese.
Bake french onion soup bites until they're puffed and golden brown, about 18 to 22 minutes. Watch carefully to be sure they don't burn. Serve warm or room temperature. Garnish with chopped thyme.