Clean, clean and slice the mushrooms. Wash thyme, shake dry, put some stems aside for garnishing. Pluck the leaves from the remaining stems. Peel onion and dice very finely
Heat 1 tablespoon of oil in a frying pan, add the ham, leave out briefly and remove. Add 1 tablespoon of oil to each pan and fry the mushrooms in 2 portions while turning them, season with salt and pepper and remove. Add the onion to the frying fat and sauté while turning, add thyme. Add ham and mushrooms again and deglaze with stock and cream. Season again with salt and pepper
Pour into a gratin dish, sprinkle with cheese and bake in a preheated oven (electric cooker: 200 °C/ convection oven: 175 °C/ gas: level 3) for 20-25 minutes. Take out and garnish with thyme