Preheat oven to 375°F (190°C).
Make the crust: In a bowl, combine flour and salt. Add butter and use a pastry blender or fingers to work it into the flour until the mixture resembles coarse crumbs. Gradually add ice water, stirring with a fork until the dough comes together. Wrap and refrigerate for at least 30 minutes.
Roll out the crust and place it in the tart pan. Trim the edges and prick the bottom with a fork.
Line the crust with parchment paper and fill with pie weights or dried beans. Bake for 10-12 minutes, or until the crust is lightly golden.
Remove the parchment paper and pie weights or beans. Return the crust to the oven and bake for an additional 5-7 minutes, or until lightly golden.
Make the filling: In a saucepan, sauté the mushrooms and onions until tender. In a separate bowl, whisk together eggs, heavy cream, shredded cheese, diced ham or bacon, salt, and pepper.
Pour the filling mixture into the baked crust and top with sautéed mushrooms and onions.
Bake for 25-30 minutes, or until the edges are golden brown and the center is set.