Preheat oven to 375°F. Grease a 9x13 baking dish and spread half the tater tots in an even layer.
Sauté onion in butter and olive oil over medium heat until soft, about 5 minutes. Add mushrooms and thyme; cook until mushrooms have released liquid and it evaporates, about 7 minutes. Season with salt and pepper.
Scatter the mushroom mixture over the tots. Sprinkle 1 cup gruyere over mushrooms. Top with remaining tots and the last 1/2 cup gruyere.
Whisk eggs and milk together; pour evenly over the casserole. Press gently so liquid reaches tots.
Bake uncovered 35–40 minutes until set and golden on top. Let rest 10 minutes before serving.