Melt the butter in a large frying pan, add the onions, sugar and chopped thyme and cook gently for 20 minutes, stirring occasionally, until the onions start to caramelize. Stir in the vinegar and cook for 1 minute. Leave to cool slightly.
Unroll the pastry sheet and place on a nonstick baking sheet. Using a sharp knife, score a line along each side of the sheet 2.5 cm (1 inch) from the edge, being careful not to cut all the way through the pastry.
Spoon the caramelized onions over the pastry, within the scored border, then top with the goats' cheese slices.
Bake in a preheated oven, 200°C (400°F), Gas Mark 6, for 20 minutes until the pastry is risen and golden. Serve garnished with a few thyme leaves.