Preheat your oven to 400°F. While it heats, lightly butter or spray 4 ramekins (or a 9x13 inch baking dish if you prefer one larger bake instead of individual portions) and arrange them on a baking sheet. Slice the mushrooms into 1/4-inch pieces, finely dice the shallot, and measure out your thyme, cheese, milk, salt, and pepper. Having everything prepped and ready will make the cooking process smooth and prevent any rushing once you start cooking the vegetables.
Heat the olive oil in a large skillet over medium heat. Once it shimmers, add the minced shallot and cook for about 3 minutes, stirring occasionally, until softened and fragrant. This gentle cooking develops the shallot's natural sweetness, which will be the flavor foundation of your egg bake.
Increase the heat to medium-high and add the sliced mushrooms along with 1/2 tsp of salt. Cook for about 5 minutes, stirring occasionally, until the mushrooms release their moisture and begin to brown slightly at the edges. This browning develops deeper, more savory flavors. Stir in the thyme and cook for another 30 seconds until fragrant, then remove from heat. I like to let the mushrooms caramelize just a bit rather than staying pale—it makes all the difference in the final dish's depth.
In a large bowl, crack the 6 room-temperature eggs and whisk them together until well combined. Add the whole milk, remaining 1/2 tsp salt, and black pepper. Whisk until the mixture is smooth and homogeneous, taking about 1-2 minutes. Room-temperature eggs incorporate more smoothly and create a silkier custard than cold ones straight from the fridge.
Divide the sautéed mushroom mixture from Step 3 evenly among the prepared ramekins (or distribute across your baking dish). Sprinkle the shredded cheese over the mushrooms in each ramekin, dividing it equally. Slowly pour the egg custard mixture from Step 4 over the mushrooms and cheese, filling each ramekin about three-quarters full. Place the baking sheet in the preheated 400°F oven and bake for 20 to 25 minutes, until the eggs are set but still slightly jiggly in the very center when you gently shake the ramekin—this ensures a custard-like texture rather than a rubbery one.
Remove the egg bakes from the oven and let them rest for 2-3 minutes. This allows the residual heat to finish setting the eggs gently and makes them easier to handle. Serve warm directly in the ramekins, or carefully turn out onto plates if desired.