Blind bake the crust: If you haven’t already, bake your pie crust until golden and fully set.
Let it cool completely so the filling doesn’t steam it soggy.
Whisk the dry ingredients: In a medium saucepan off the heat, whisk together sugar, cocoa powder, cornstarch, and salt until no cocoa lumps remain.
Temper with milk: Gradually whisk in about 1/2 cup milk to make a smooth paste. Then slowly add the rest of the milk, whisking constantly so it’s lump-free.
Cook the custard base: Set the pan over medium heat. Cook, whisking steadily, until the mixture warms and starts to thicken, 5–8 minutes.
Don’t rush it; gentle heat prevents scorching.
Temper the yolks: In a small bowl, whisk the egg yolks. Ladle in a splash of the hot mixture while whisking the yolks, then another splash. Pour the warmed yolks back into the pan, whisking all the while.
Thicken to pudding stage: Continue cooking over medium heat, whisking, until the custard is glossy and thick enough to coat the back of a spoon, 2–4 minutes.
Small bubbles will plop up; that’s your cue it’s ready.
Add chocolate and butter: Remove from heat. Immediately add the chopped chocolate, butter, and vanilla. Whisk until completely smooth and shiny.
Strain for silkiness: For the smoothest texture, pour the custard through a fine-mesh sieve into a bowl.
This catches any tiny lumps or bits of cooked egg.
Fill the crust: Scrape the warm filling into the cooled crust. Smooth the top with a spatula so it sets evenly.
Prevent a skin: Press a piece of plastic wrap directly onto the surface of the filling. This keeps the top from forming a rubbery layer.
Chill until set: Refrigerate at least 4 hours, or overnight for the cleanest slices.
Finish and serve: Peel off the plastic.
Top with soft peaks of whipped cream and a dusting of cocoa or chocolate shavings. Slice with a warm, clean knife for neat wedges.