Wipe mushrooms clean with a damp paper towel (do not rinse), then slice into 1/4-inch (6mm) slices. Finely dice onion and mince or grate garlic.
Melt butter in a large pot or Dutch oven over medium heat. Add diced onion and cook until soft and translucent, about 4-5 minutes.
Add minced garlic and cook, stirring constantly, for about 60 seconds until fragrant. Do not let it burn.
Add sliced mushrooms and increase heat to medium-high. Cook 7-10 minutes, stirring only occasionally, until liquid evaporates and mushrooms turn golden brown at the edges.
If using sherry or wine, add it now and deglaze the pot, scraping up browned bits. Let cook 1-2 minutes until mostly absorbed.
Sprinkle flour over mushrooms and stir to coat completely. Cook, stirring constantly, for 1-2 minutes to remove raw flour taste.
Slowly pour in broth while stirring continuously. Add thyme, salt, and pepper. Bring to a gentle boil, then reduce heat and simmer 10-12 minutes until thickened.
Remove from heat and blend with an immersion blender to your desired consistency (smooth or chunky). If using a countertop blender, cool slightly and blend in batches.
Return pot to low heat. Stir in heavy cream and heat through for 3-5 minutes. Do not let boil. Adjust seasoning with salt and pepper.
Ladle into bowls and garnish with fresh parsley, thyme, or a drizzle of cream. Serve immediately with crusty bread or croutons.