In a large, heavy bottomed pot melt the butter over low heat. Add the onions, thyme, crushed red pepper flakes, and salt; cook, stirring occasionally, until the onions are deep amber in color and very soft, about 45 minutes. Add the flour and cook for 1 to 2 minutes, then add the wine; increase the heat and let the wine simmer for 2 to 3 minutes, stirring constantly. Add the beef stock and bring soup to a boil, then reduce to a simmer and cook for another 45 minutes.
Remove thyme sprigs from the soup and discard. Season to taste.
When ready to serve:
Preheat oven to broil. Arrange a rack in the middle of the oven. Arrange the baguette slices on a baking sheet and place in the oven for 2 minutes, or until toasted. Keep a close eye here so they don't burn!
Divide the soup among 4 ovenproof bowls. Place a few pieces of toasted baguette on top of each bowl, then cover with a thick layer of Gruyère cheese. Place the soup bowls on a large baking sheet, then carefully place the baking sheet under the broiler for 3 to 5 minutes, or until the cheese is fully melted and golden. Serve at once.
This recipe will make 4 dinner sized potions, or 6 appetizer sized portions.