Melt half the butter with the olive oil in a saute pan, and gently fry the onions until soft and lightly golden, about 15 minutes. Spread half the onions in the bottom of a casserole. Lay a layer of sliced potatoes on top, season with salt and pepper, and scatter with thyme leaves. Build another layer of onions, then a final one of potatoes, and finally pour over the stock. Cover the pan with foil, and bake until all the liquid has been absorbed, 2 to 3 hours, removing the foil for the last hour if you like a crisp top.