Thinly slice the onions. I recommend using the slicing blade of a food processor for this.Melt the butter in a large stock pot, and add the onions, thyme, bay leaves, and garlic. Cook and stir over medium heat until the onions are very soft and a lovely shade of golden brown. This should take 30-40 minutes.Add the red wine all at once, and continuing cooking and stirring until the onions are dry and the wine has cooked out.Remove the bay leaves and thyme springs (if you were using fresh).Sprinkle the flour on top, and allow it to cook for another 5 minutes, or until it has browned.Pour in the stock and balsamic vinegar and allow the soup to simmer and thicken for around 20 minutes. Season to taste with salt and pepper.Place the soup into oven-safe bowls or ramekins. Top with a slice of crusty bread and a generous handful of grated cheese.Pop into the oven and broil until the cheese is bubbly and brown.(If you don't want to place your bread on top, you can serve it on the side.)