Slice onions and mince garlic.
Melt butter in a heavy bottom pan and place over low heat.
Add onions and cook, stirring occasionally for about 20 - 30 minutes.
Add garlic and brown sugar, stir to combine. Continue to cook about 20 minutes or until onions are caramelized.
Season with thyme, salt and pepper. Whisk in flour and cook for about 5 minutes.
Add about a cup of beef broth, scraping the bottom of the pan to remove the browned bits.
Whisk in remaining beef broth and raise to medium-high heat and bring to a boil. Whisk until soup is thickened. Remove from heat.
Slice baguette, spread with butter and lightly toast.
Ladle soup into oven safe bowls and place on a baking sheet.
Top with toasted baguette and shredded cheese.
Broil for a few minutes, watching carefully, until cheese is melted and starts to brown.
Serve immediately.