To the remaining herb-butter mixture, add the caramelized onions and cook until the mixture is hot and there is very little liquid, about 5 minutes. Add the wine, bring to a boil, reduce the heat and simmer until the wine has evaporated and the onions are nearly dry, about 5 minutes. If you used fresh thyme, discard the thyme sprigs. Sprinkle the flour over the onions and stir to combine. Reduce the heat to low and cook for about 5 minutes, stirring frequently. (This is to cook out the raw flour taste.) Now add the vegetable stock, return to a simmer, and cook for another 5 to 10 minutes. Season, to taste.