Split the pumpkin in half, spoon out the seeds and place the pumpkin halves face down on a baking tray. Split the potatoes lengthways and place on the tray with the pumpkin. Bake the pumpkin and potatoes for 1 hour. Remove them from the oven and let them cool. When the pumpkin has cooled, spoon out the flesh and put it into a large bowl. Cut the potato into 1.25cm cubes.
To make the dough: in a food processor fitted with a steel blade, put the flour and salt into the processor. Add the butter. Run the machine in spurts until the butter is in bits no bigger than pea-size. Add 4 tablespoons ice water and run the machine in spurts again just enough to bring the dough together. Turn the dough onto a work surface and knead it with your hands until the dough is soft and smooth, handling the dough as little as possible. Form it into a flattened ball. Chill the dough for at least 30 minutes.
Preheat the oven to 190 C / Gas 5. On a floured surface, roll out the dough and use it to line the bottom and sides of either a 23cm square baking tin or a large deep dish. Pierce the dough with a fork in three places. Line the sides of the tin with foil and crimp the foil gently to hold the dough in place.
Bake the pastry for 15 minutes. Remove the tin from the oven. Reduce the heat to 180 C / Gas 4. While the pastry bakes, make the filling.
Heat the oil in a large frying pan over medium heat. Add the onions, and cook them, stirring frequently, until they soften, about 5 minutes. Add the garlic and cook for 3 to 4 minutes more, stirring frequently. Add the sweetcorn and cook for 2 more minutes. Remove the frying pan from the heat.
Stir in the pumpkin, potato, cheese, thyme, allspice, salt and pepper. Mix well, then spoon into pre-baked pastry case.
Bake the pie at 180 C / Gas 4 for 30 minutes or until veggies and cheese are piping hot. Serve immediately.
Sugar pumpkins look like a miniature version of the large Jack-o-lantern pumpkins available during Halloween. They are smaller, sweeter and have more flavour. If unavailable, you can use 900g butternut squash instead.