Heat oil in a Dutch oven or soup pot over low heat. Add onion and cook, stirring until soft and translucent, 5 to 7 minutes. Add thyme and cook for 1 minute more.
Stir in mushrooms, cover pot and steam until the mushrooms exude their moisture, about 5 minutes. Sprinkle flour over the mushrooms. Increase heat to medium and cook, stirring, for 3 to 4 minutes.
Gradually whisk in broth, scraping up any flour that clings to the pan. Simmer, stirring occasionally, until thickened and smooth, 5 to 7 minutes.
Combine sour cream and milk; whisk into the mushrooms. Season with salt and pepper. Gently heat until the soup is hot but not boiling.
Just before serving, stir in lemon juice and sherry (if using).
Notes
Sherry is a type of fortified wine originally from southern Spain. Don’t use the “cooking sherry” sold in many supermarkets—it can be surprisingly high in sodium. Instead, purchase dry sherry that’s sold with other fortified wines in your wine or liquor store.