Heat a small skillet with the butter over medium heat. Add the onions and season with salt, the ground thyme and 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 size pot and cover with water. Bring to a boil, then salt the water and cook until tender, 12-15 minutes. Drain and return the potatoes to the hot pot. Mash the potatoes with the cream and Parmigiano Reggiano and season with salt and pepper, to taste.
Pre-heat the broiler.
Arrange the mashed potatoes in individual gratin dishes or one shallow casserole dish. Top the potatoes with the onions and Gruyère cheese. Place the dish(es) on a sheet pan and brown under a hot broiler until bubbly, about 2 minutes. Remove from the oven and serve hot.