Get prepped: Preheat the oven to 375°F. Dice ½ cup onion, mince 2 cloves garlic, slice 8 ounces mushrooms, and measure all ingredients.
Sauté the vegetables: Melt 2 tablespoons butter in a large skillet over medium-high heat. Add onions and cook for about 4 minutes, until softened. Stir in garlic and cook for 1 minute.
Add mushrooms and seasoning: Add mushrooms and season with 1 teaspoon dried thyme and salt and pepper. Cook until the mushrooms soften and release their moisture.
Make the sauce: Sprinkle ¼ cup all-purpose flour over the vegetables and stir until combined. Slowly stir in 1 cup chicken stock and bring to a simmer. Reduce heat to medium, add 1 cup half-and-half, and cook until thickened.
Combine and bake: Remove from heat and stir in 4 cups green beans until well coated. Transfer the mixture to an oven-safe skillet or baking dish. Top with 1 cup fried onions and bake for 15 minutes, or until bubbling.
Cool and serve: Let the casserole cool for about 5 minutes before serving.