Step 1Heat the oven to 400 degrees. Cut the squash in half and remove the seeds. Place the squash cut-side down in a roasting pan and add about half an inch of water. Bake until the squash is easily pierced with a knife, about 1 hour.
Step 2Wipe the mushrooms clean, trim any hard stems and cut them into thick slices. Heat 3 tablespoons of the butter in a large skillet over medium-high heat until the foam has subsided and the butter turns a light hazelnut color. Add the mushrooms, sprinkle with three-fourths teaspoon salt, cover tightly and cook, tossing occasionally, until the mushrooms begin to glisten and give up their moisture, about 3 minutes.
Step 3Remove the cover, add the shallots, raise the heat to high and continue cooking, stirring constantly until the mushrooms are richly aromatic and soft, but not flaccid, about 3 minutes. Transfer the mushrooms to a bowl and set aside.
Step 4Reduce the heat to low and, without wiping out the pan, add the prosciutto. Cook on low heat for about 5 minutes. Meanwhile, cut away the dark green leaves of each leek, then cut in quarters lengthwise, leaving the leeks attached at the roots. Rinse thoroughly under cold, running water and slice thinly crosswise. Add the leeks to the prosciutto and cover tightly. Let the prosciutto and leeks sweat slowly, stirring occasionally until the leeks are quite tender, about 10 minutes.
Step 5Add the mushrooms back to the pan along with any liquid that has accumulated in the bottom of the bowl. Stir to combine with the prosciutto and leeks. Add the creme fraiche and continue to cook slowly, stirring occasionally, while you clean the squash.
Step 6Remove any scorched spots from the cut side of the squash. Hold one squash half over a large bowl, and with a fork, scrape out the strands, separating them as you work from one end of the squash to the other. When there is little left but the skin, empty the squash strands into the bowl. Repeat with the other half, adding it to the same bowl. Season the squash strands with 2 teaspoons salt and stir well to combine.
Step 7Add the mushroom mixture to the squash and again stir to combine. Transfer the mixture to a 2-quart gratin dish, mounding it slightly in the center. Add the heavy cream, shaking the pan gently to distribute the cream through the squash. The cream should just be visible around the edge of the squash. Bake until the cream is bubbling and beginning to darken around the outside, about 15 minutes.
Step 8While the gratin is baking, prepare the bread crumbs. Cut away the crusts of the bread and cut the interior into cubes. Process in a blender to make coarse bread crumbs; you should have about 2 1/2 cups. Add the Parmesan and pulse 3 or 4 times to thoroughly combine with the bread crumbs.
Step 9Scatter the bread crumbs evenly over the gratin, then dot with the rest of the butter. Return to the oven and bake until the top is golden brown, about 15 minutes. Cool slightly before serving.