In a dutch oven, over medium-high heat, melt butter. Add onions and cook until softened, 6-8 minutes. Add garlic, thyme, salt and pepper and stir about 30 seconds.
Stir in broth, cream and bay leaves. Add potatoes and bring to a simmer. Cover, reduce heat to medium-low. Stir often until potatoes are mostly tender, about 15 minutes.
Discard bay leaves. Pour mixture into a 9"x13" baking dish and press gently. Sprinkle with cheese.
Cover with foil and bake at 400 degrees for 25 minutes. Remove foil and bake 10 minutes more. Let cool for 10 minutes before serving.
If preparing in advance or freezing, omit cheese and cover with plastic wrap. Cut a few vents in plastic wrap and cover with foil. Refrigerate for up to 2 days or freeze up to one month. Thaw completely in refrigerator for 24 hours. Remove plastic wrap and replace foil before baking. Bake covered with foil for 30-40 minutes; remove foil and bake 30 minutes more. Let cool for 10 minutes before serving.