Heat olive oil in a heavy based pot. Add onions, salt and pepper, and cook over a medium heat for 20 minutes until nice and soft, stirring every once in a while so that they don’t catch on the bottom. Add balsamic vinegar and sugar, remove the lid and cook a further 10 minutes, stirring occasionally. Set aside to cool.
Put potatoes in a medium pot, cover with water, season with salt and bring to a boil. reduce heat to a simmer and cook potatoes 15-20 minutes until just able to be pierced with a knife. Drain and set aside to cool.
Roll out pastry to fit a round removable base tart tin. Pop in the freezer to chill while the oven heats to 350˚F. Layer the onion, potato and chicken into the pastry shell. Dot with brie and thyme. If you happen to be using left-over roast chicken and have a bit of stuffing spare, pop that in too! Whisk eggs and cream and pour over filling. Bake for 35-40 minutes until the filling is set and the pastry is golden.