Peel and slice onions.
In a heavy bottom pot or preferably a dutch oven heat oil and butter together.
Add sliced onion and stir to coat onions with oil butter mixture. Cover and cook for 20 minutes on medium-low heat. Keep stirring in every 10 minutes to cook it evenly and also prevent it from burning.
At the end of 20 minutes the onions would have softened and reduced to half the quantity. You will also observe the bottom of the dutch oven started to brown. The onions needs to be cooked for another 25-30 minutes for it to be caramelized perfectly.
Add salt and cook uncovered for another 25-30 minutes. Keep stirring every 5 minutes to avoid onion getting stuck at the bottom and burn. Last 10 minutes is important as the onions are almost caramelized and have more chances of getting burned. ( The onions will go from caramelized to burnt in no time, so keep a close eye towards the end). Also keep scraping the bottom of the pot to release any stuck onions.
Towards the end add minced garlic, bay leaf, minced thyme, and pepper. Saute for a minute.
Increase the heat to high-medium. Stir in the wine and cook until the wine has almost reduced to half. There should not be any alcohol smell.
Reduce heat. Add flour and mix well. Cook for 1-2 minutes until there is no raw flour smell. Scarp the bottom of the pan to remove anything stuck to the pan.
Stir in beef broth and remaining thyme sprig. Mix well, once it comes to a boil reduce the heat, cover and simmer for 10 minutes.