In a large skillet over medium heat, melt the olive oil and butter together. Add the sliced onions and cook, stirring occasionally, until softened, about 5 minutes. Season with a generous pinch of salt and a few cracks of black pepper.
Continue cooking, stirring every few minutes, until the onions are deeply golden and caramelized, 30-35 minutes. During the last 5 minutes, add the thyme sprigs.
Meanwhile, bring a large pot of water to a boil. Salt it generously, then cook the spaghetti until al dente. Reserve ½ cup of the pasta water, then drain.
Lower the heat under the onions and remove the pan from the burner. Carefully add the cognac, then return the pan to low heat. Simmer for 2-3 minutes, scraping up any browned bits, until the alcohol cooks off.
Stir in the sherry vinegar, Worcestershire sauce, and beef stock. Increase heat to medium-low and let simmer until slightly reduced and thickened, about 5 minutes. Stir in the heavy cream and cook for 2 minutes more. Remove and discard the thyme sprigs.
Add the spaghetti directly to the sauce and toss to coat, adding a splash of reserved pasta water as needed to loosen the sauce to your preferred consistency.
Serve into bowls and top with grated Parmesan and fresh herbs.