Cook pasta in a large pan of salted, boiling water until al dente. Drain well.
Meanwhile, heat oil in a medium pan on medium-high heat. Cook onion and garlic for 3-4 minutes until softened. Add beef and cook until browned, breaking up lumps with a spoon. Add sweet potato and zucchini. Cook for 2 minutes until softened slightly.
Add paste, tomatoes, stock and thyme. Simmer, uncovered for 15-20 minutes until thickened slightly. Stir through spinach leaves until wilted.
Meanwhile, preheat oven to 220C/200C fan-forced.
Combine pasta and beef mixture in an 8-cup capacity ovenproof dish. Sprinkle with ricotta, parmesan and pine nuts. Bake for 15-20 minutes until golden.