Take the pastry out of the fridge 30 minutes before using.
Preheat the oven to 200 C / Gas 6. Line a 23cm quiche dish with the pastry, ensuring the sides are coming up just over the rim. Prick the base with a fork. Line the base with baking parchment or foil and fill will ceramic baking beans or dry rice.
Bake in the preheated oven for 15 minutes. Remove and discard the beans/rice and paper/foil. Place back in the oven for a further 5 minutes. Reduce the oven temperature to 180 C/ Gas 4.
Meanwhile, heat a frying pan with the butter and cook the onions slowly until translucent and slightly caramelised. Add the mushrooms and ham. Cook for a further 5-10 minutes. Remove and set aside.
In a mixing bowl, whisk together the beaten eggs, buttermilk, salt, pepper and herbs.
Add the mushroom mixture to the pastry case and pour over the egg mixture. Add 1 handful of the cheese on top. Place onto a baking tray.
Bake for 20 minutes, then carefully remove and add the remaining handful of cheese. Place back in the oven for until a knife inserted near the centre comes out clean and the top is golden, about 20 minutes more.
Remove from the oven and allow to rest for 10 minutes before serving.