Melt butter in a large skillet over medium-low heat. Add onions, season with salt and pepper. Add bay and thyme, and cook low and slow until caramel in color and very soft. Deglaze with sherry or dry white wine. Add stock to onions and bring to a bubble.
Cut the top third off of the baked potatoes, scoop inside flesh into a bowl and arrange the potato shells on a baking sheet. Combine the flesh of the potatoes with about half the onions and refill the potatoes. Top stuffed potatoes with remaining onions and lots of Gruyère. Broil or bake until brown and bubbly.