Sauté: Heat the butter in a deep and wide skillet over medium heat. Add the onion, garlic and mushrooms and cook until they're soft and lightly browned, about 5-10 minutes.
Season: Stir thyme, salt and pepper into mushrooms. Sprinkle pan with flour and stir in well. Stir in tomato paste and cook for 30 seconds, stirring constantly.
Deglaze the pan: Increase the heat to medium-high. Wait until pan sizzles, then pour the wine or extra stock over the mushrooms, scratching the browned bits off the bottom of the pan. Reduce the heat to medium-high and cook until almost all of the wine has evaporated.
Cook the sauce: Stir in the stock. Simmer the sauce until it has reduced by half. If sauce doesn't thicken/you want a thicker gravy, stir in a slurry of cornstarch and water.
Finish: Take the sauce off the heat and stir in the cream, if using.
Serves 2 as the main part of a vegetarian meal (such as the sauce for pasta) or 4-6 as an actual sauce on a protein.