Heat a small skillet with the butter over medium heat. Add the onions, season with salt ground thyme, bay leaf and cook until very soft and sweet and lightly caramelized, 20 minutes. Season with salt and pepper, to taste, and discard the bay leaf.
While the onions cook, put the potatoes in a medium pot and cover with water. Bring to a boil, then salt the water and cook to tender, 12 to 15 minutes. Drain and return the potatoes to the hot pot. Mash the potatoes with the cream and Parmesan and season with salt and pepper, to taste.
Preheat the broiler.
Arrange the mashed potatoes in individual gratin dishes or 1 shallow casserole. Top the potatoes with the onions and Gruyere cheese. Put them on a sheet pan and brown under a hot broiler until bubbly, about 2 minutes. Remove from the oven and serve hot.