Preheat the oven to 200°C, 180°C fan, 400°F, Gas Mark 6. Toss the cubed pumpkin with salt and pepper and 2 tablespoons olive oil. Spread out on a baking sheet and roast for 25-30 minutes, until beginning to brown.
Meanwhile, put the stock in a saucepan and bring to the boil. Turn down the heat and leave to simmer gently.
Put the remaining half tablespoon olive oil and 15g butter in a separate, large saucepan over a medium heat. Stir in the shallots and cook for 5 minutes, until soft but not coloured.
Add the rice and stir to coat in the fat. Cook for a minute then add the wine, if using, stirring until none remains. Add a ladle of stock and cook down, stirring, until it has nearly disappeared. Keep adding single ladles of stock and stirring until absorbed for the next 10 minutes. Stir in half the roast pumpkin cubes and continue adding stock and stirring, as before, for another 5 minutes. Now stir in 1 teaspoon thyme, the remaining pumpkin and two-thirds of the ham. Cook for 3 minutes, the rice should now be cooked, but still have a little bite. Remove the pan from the heat and add the remaining 15g butter and half the grated Parmesan. Cover and leave for 5 minutes.
Meanwhile toast the walnuts in a dry pan until golden then chop roughly. Stir the rested risotto and serve in shallow bowls with the walnuts, remaining ham, thyme and Parmesan scattered over.
For top tips on protecting you and your family when preparing raw meat and poultry, visit Food Safety in the Home.