Start by placing the thinly sliced potatoes and pumpkin by layers in a gratin dish and set aside.
For the béchamel, use a medium saucepan to heat the butter over medium-low heat until melted. Add the cornstarch and stir until smooth. Cook until the mixture turns light golden, about 5 minutes.
Meanwhile, heat the milk and add it to the butter mixture in three times, whisking continuously until very smooth. Bring to a boil. Cook 10 minutes, stirring constantly, then remove from heat. Season with salt, nutmeg and pepper, and pour it over the potatoes and pumpkin.
Preheat the oven to 350ºF/ 180ºC.
Transfer gratin dish to oven, and bake for 45 minutes to one hour.
Top with fresh thyme and serve.