Heat oven to 150ºC. Rub the meat with 1 teaspoon of the oil and plenty of seasoning. Heat a large flameproof casserole dish and brown the meat all over for about 10 minutes. Meanwhile, add 2 teaspoons of oil to a frying pan and fry the carrots and celery for 10 minutes until they turn golden.
Lift the beef onto a plate, splash the wine into the hot casserole and boil for 2 minutes. Pour in the stock, return the beef, then tuck in the carrots, celery and bay leaves, trying not to submerge the carrots too much.
Cover and cook in the oven for 2 hours, turning after an hour of cooking.
Meanwhile, thinly slice the onions. Heat 1 tablespoon of oil in a pan and stir in the onions, thyme and some seasoning. Cover and cook gently for 20 minutes until the onions are softened but not coloured.
Remove the lid, turn up the heat, add the butter and sugar, then let the onions caramelise to a dark golden brown, stirring often. Remove the thyme sprigs, then set aside.
When the beef is ready, it will be tender and easy to pull apart at the edges. Remove beef and carrots from the casserole.
Reheat the onion pan, stir in the flour and cook for 1 minute. Whisk the floury onions into the beefy juices in the casserole, to make a thick onion gravy.
Taste for seasoning. Add the beef and carrots back to the casserole, or slice the beef and bring to the table on a platter, with the carrots to the side and the gravy spooned over.