Preheat the Oven: Preheat the oven to 180ºC (160ºC fan).
Prepare the Onions and Garlic: Peel and thinly slice the onions and mince the garlic.
Sauté Onions and Garlic: Melt the butter in a skillet over medium heat. Sauté the onions, garlic, and thyme until soft and translucent, about 10 minutes.
Prepare the Potatoes: While the onions are sautéing, peel and thinly slice the potatoes.
Layer the Ingredients: Grease a casserole dish (30cm x 20cm) or a 30cm skillet. Place the softened onions and potatoes in alternating layers in the dish.
Add the Stock: Pour the hot stock evenly over the potatoes.
Bake: Cover the dish with foil and bake in the preheated oven for 45 minutes.
Finish Baking: Remove the foil and brush the top layer of potatoes with some melted butter. Bake uncovered for an additional 15 minutes, or until the potatoes are golden on top.