Bring a large pot of salted water to a boil. Add the spaghetti and cook according to the package instructions until al dente. Drain, reserving ½ cup of the pasta water, then toss the spaghetti with 3 tablespoons of the oil. Keep warm.
Meanwhile, to a large skillet over medium-high heat, add the remaining oil. When it’s hot and shimmering, add the beef, thyme, chile flakes, thyme, and garlic, and cook, breaking up the beef with a wooden spoon, until the beef is browned, 5–7 minutes. Add the tomato paste and sugar, season to taste with salt and black pepper, and cook for about 2 minutes. Add the wine and cook until it has almost evaporated, about 2 minutes. Add the vinegar, lemon zest and juice, and spaghetti, and toss to combine. Add the tomatoes, olives, and reserved pasta water, and cook for about 2 minutes more.
Transfer to a platter, garnish with basil, and serve with parmesan.
