Remove the tenderloin from the refrigerator 1 hour prior to cooking.
On the tail end of the tenderloin, about a third of the way from where it begins to taper, make an incision almost all the way through the beef. Fold the tail onto the larger portion to make an even cylinder throughout. Use ten to twelve 8-inch pieces of butcher's twine to tie the tenderloin crosswise every 3/4 to 1 inch. This will help it to keep its shape and cook evenly.
Preheat the oven to 225 degrees F.
Pat the tenderloin dry. Brush with 1 tablespoon of the olive oil and season heavily with salt and pepper all around. Put the remaining 3 tablespoons olive oil in a cast-iron pan over medium-high heat. When hot, add the beef and sear on all sides until a nice crust is formed, 1 to 2 minutes per side. Add the thyme, garlic and 3 tablespoons of the butter to the pan. Once the butter is melted, use a spoon to baste the beef with the herb and garlic infused butter for 30 seconds.
Transfer the beef to a rack on a baking sheet, spoon over 2 tablespoons of the herb and garlic butter mixture from the cast-iron pan (reserve the pan) and roast until the internal temperature of the thickest part reaches 120 degrees F (for medium rare), 1 to 2 hours, depending on the size of the tenderloin. Cover the beef with foil and rest for 15 minutes.
Add the shallots to the remaining herb and garlic butter mixture in the cast-iron pan and sweat over medium heat until translucent, 3 to 5 minutes. Deglaze with the red wine and reduce until almost dry, 5 to 8 minutes. Add the beef stock, bring to a simmer and reduce by half, 10 to 15 minutes.
Meanwhile, thoroughly mix the remaining 2 tablespoons butter with the flour in a small bowl.
Reduce the heat to low and slowly whisk in the butter and flour mixture bit by bit, until the sauce reaches the desired consistency. Serve with the perfectly roasted beef.