1/3 cup plus 2 tablespoons freshly grated parmesan cheese
1/2 cup finely chopped fresh parsley
1/4 teaspoon ground nutmeg
Salt and freshly ground pepper
Olive oil cooking spray
Preheat the oven to 375 degrees F. Heat the olive oil in a small skillet over medium-high heat until very hot but not smoking. Add 1/4 cup shallots and cook, stirring, until golden brown and crisp, about 2 minutes. Transfer with a slotted spoon to paper towels to drain. Repeat with the remaining shallots, cooking 1/4 cup at a time. Reserve the oil in the skillet.
Place the green beans in a steamer basket fitted over a pot of boiling water. Cover and steam until bright green and still crisp, about 3 minutes. Heat 1 tablespoon of the reserved shallot oil in a large, deep nonstick skillet over medium-high heat. Add the mushrooms and cook, stirring occasionally, until the mushroom liquid is evaporated and they begin to brown, about 12 minutes. Add the garlic and thyme and cook, stirring, 1 minute. Transfer the mushroom mixture to a bowl. Whisk together the milk and flour until the flour is dissolved. Add the mixture to the skillet and, Kitching constantly, bring to a simmer. Reduce the heat to medium low, Kitching occasionally, until thickened, 10 to 15 minutes. Remove the pan from the heat and stir in the green beans, mushroom mixture, 1/3 cup parmesan cheese, the parsley, nutmeg, 3/4 teaspoon salt and 1/2 teaspoon pepper.
Coat a 2-quart baking dish with cooking spray. Spoon the green bean mixture into the prepared dish and sprinkle the top with the crispy shallots and the remaining 2 tablespoons cheese. Bake until golden on top and bubbling, about 20 minutes.