Gently heat a knob of butter and a splash of olive oil in a heavy based pan. Add thinly sliced onions, cook over a gentle heat stirring often until they are soft and caramelised. You want a soft brown unctuous mass.
Add a couple of sprigs of thyme or a shake of dried thyme and if you have it a bay leaf.
Add a tbs of plain flour and stir into the onions until the flour has absorbed the fat. Carefully add a glass of wine, a splash at a time stirring as you go until all the wine has been incorporated and you have a smooth roux.
Begin adding stock, again gently so that it all becomes one.
Once all the stock has been added, leave to simmer for a few minutes to cook off the flour and you can adjust the seasoning and add any tweaks you might feel necessary - a splash of Worcester sauce, a smidge of mustard, a touch of balsamic vinegar, a dab of marmite, etc - I'm often amazed by the things folk add to gravy!