In a large dutch oven, heat oil over medium heat.
Add onions, garlic, thyme, salt, pepper and sugar and turn to medium low.
Cook for 50-60 minutes, until nicely browned, stirring often and scraping up browned bits from the bottom of the pot.. If onions start to stick, reduce the heat.
Add the sherry and continue to cook until almost evaporated, about 4 minutes.
Discard the thyme sprig.
Stir in butter until melted.
Add the flour and cook for one minute.
Slowly stir in the broth and increase the heat to medium.
Simmer for 20 minutes.
Place some soup in each bowl, top with two slices baguette, some shredded gruyere, and another small ladle of soup.
Sprinkle with fresh parsley.