Preheat the oven to 220°C (gas 7). Toss the onions with the oil, sugar and seasoning in a large bowl. Spread in a large roasting tin and drizzle with 50ml water. Cover with foil and roast for 30 minutes, then uncover and roast for 10 minutes. Add the thyme and roast for a further 20 minutes, stirring often, until the onions are brown and tender.
Place the roasting tin on the hob, over a high heat. Add the wine and stir for 2 minutes with a wooden spoon, scraping the onions and browned bits from the bottom of the tin, until the wine is syrupy.
Transfer the onions and pan juices to a large saucepan. Stir in the stock, bring to the boil, then reduce the heat and simmer for 15 minutes until the flavours are blended.
Meanwhile, preheat a moderate grill. Place the bread slices on a baking sheet and toast for 2 minutes on each side.
Ladle the soup into four heatproof bowls. Float a bread slice in each bowl and sprinkle with cheese. Place the bowls in the grill pan or a shallow baking tin and grill on a low shelf for 2 minutes or until the cheese is melted and bubbling. Serve immediately.
It's not essential to use wine in this soup although it does boost the flavour. You can just use more vegetable stock instead.