Heat the oil in a medium saucepan and fry the onions over a low heat for 10 minutes, until softened and golden.
Sprinkle the flour into the pan and stir until the flour has been incorporated and made a thick paste. Add the thyme and stock and bring to a boil, then lower the heat and simmer for 10 minutes.