1 prepared 9-inch pie shell
1/4 cup cornstarch
1/3 cup plus 2 tablespoons sugar, divided
3 tablespoons unsweetened cocoa powder
1/4 teaspoon salt
3 cups whole milk
4 oz bittersweet chocolate (not more than 60% cacao), finely chopped
1 teaspoon pure vanilla extract
1 cup chilled heavy cream
Garnish: bittersweet chocolate shavings (optional)
Whisk together cornstarch, 1/3 cup sugar, cocoa powder, and salt in a 2-qt heavy saucepan, then gradually whisk in milk. Bring to a boil over medium heat, whisking constantly, then boil, whisking, 2 minutes (mixture will thicken). Remove from heat and whisk in chocolate and vanilla until smooth.
Pour filling into cooled shell and chill, its surface covered with wax paper (if you want to prevent a skin from forming), until cold, at least 2 hours.
Just before serving, beat cream with remaining 2 Tbsp sugar until it just holds soft peaks. Spoon onto pie.
Pie (without whipped cream) can be chilled up to 1 day.