Preheat the oven to 180˚C/160˚C fan/Gas 4
Put the onions in a lidded casserole dish. Stir in the vinegar, sugar and garlic. Season well, add the bay leaf and thyme, dot with butter and cover with foil, shiny side down, and the lid. Bake for 1½ hours, stirring after 1 hour, until tender and golden.
Stir in the flour until well blended, then pour in the wine and stock. Re-cover with foil and the lid and return to the oven for 45 minutes
Remove the foil from the onion mixture, stir well and discard the bay leaf and thyme. Preheat the grill to hot. Toast the bread on both sides, then spread with mustard and sprinkle with cheese. Grill until the cheese is lightly golden and bubbling
Ladle the soup into warm bowls and arrange the toasts on top, sprinkle with parsley, if using, and serve