Add the onions and a couple of knobs of butter to the empty casserole dish. Stir in the sugar and thyme, then cook for 10–15 minutes over a medium heat, stirring now and again until the onions are completely caramelised. Add the mushrooms, stir, and continue to cook for 5 minutes. Pour in the vinegar and cook for a further 5 minutes.