Bring a large pot of water to a boil and set aside a separate large bowl with ice water. Add the green beans to the boiling water. Once the water returns to a boil, set a timer for 5 minutes. Cook until the beans are bright green and tender with a little bite left.
Plunge the beans into an ice bath to stop the cooking. Drain them well while you make the sauce. Preheat the oven to 350°F.
Heat the butter, thyme, and mushrooms in a large skillet over medium heat. Cook 5 to 7 minutes, stirring frequently, until the mushrooms are soft.
Add the garlic and sprinkle the flour over the mushrooms. Cook 1 minute, stirring, until the mushrooms are coated. The mixture will look chunky, which is fine.
Add the chicken broth and bring to a simmer over medium heat. Simmer 60 to 90 seconds, until thickened.
Remove the skillet from the heat. Stir in the heavy cream, salt, and pepper. Taste and add more salt if needed.
Add the blanched and drained green beans to the sauce and stir until coated.
Pour into a 13x9 pan and bake uncovered at 350°F for 25 to 30 minutes, until the sauce is bubbling around the sides.
Sprinkle the fried onions over the top and bake 5 minutes more, until the onions are browned. If you start to smell the onions before the time is up, remove the casserole from the oven immediately to keep them from burning.
Let the casserole rest 15 minutes before serving.