Preheat the oven to 180 °C and grease an ovenproof dish with nonstick spray.
1. Make a white sauce: heat the butter in a small saucepan over medium to low heat and stir in the flour to form a smooth paste. Slowly whisk in the milk, season with salt and pepper and continue whisking until thickened.
2. Heat the oil in a pan and fry the mushrooms with the thyme until browned.
3. Mix the mushrooms and remaining ingredients, setting a bit of the cheese aside. Pour the white sauce over and mix well.
Spoon into the prepared dish, sprinkle the remaining cheese over and bake for 15-20 minutes or until the cheese has browned.