Remove the puff pastry sheet from the freezer and let it thaw according to package instructions. Once thawed, gently roll it out on a lightly floured surface to smooth any creases and create an even rectangle or square about 12x12 inches. Transfer it onto a parchment-lined baking sheet.
Heat the olive oil in a non-stick skillet over medium-low heat. Add the thinly sliced onions and a pinch of salt. Cook slowly, stirring occasionally, for about 20-25 minutes until the onions turn a deep golden brown and soften. Towards the last 5 minutes of cooking, stir in the sugar and balsamic vinegar. The onions should be sweet, sticky, and richly caramelized.
Spread the caramelized onions evenly over the puff pastry, leaving a small border around the edges (about 1 inch). Sprinkle the shredded mozzarella cheese evenly over the onions. Then scatter the fresh thyme leaves on top.
Bake the tart in a preheated 400°F (200°C) oven for 15-20 minutes, or until the pastry is puffed and golden brown and the cheese is melted and bubbly. Keep an eye on it to avoid burning the edges.
Let the tart cool slightly before slicing into squares or rectangles. Serve warm with a fresh salad or soup.