Set a rack in the center of the oven and heat to 325°F. Line a 12-cup muffin tin with paper liners.
In a medium bowl, whisk together the flour, cocoa, espresso powder, baking powder, baking soda, and fine sea salt until evenly combined.
Place the butter and chopped bittersweet chocolate in a heatproof bowl. Melt gently over a pan of barely simmering water or in 20–30 second bursts in the microwave, stirring until smooth. While still warm, whisk in the granulated sugar and vanilla until glossy; cool 3 minutes.
Whisk the sour cream into the chocolate mixture until silky. Add the eggs one at a time, whisking just until incorporated after each addition.
Add the dry mixture in two additions, folding with a spatula just until no dry spots remain. Let the batter rest for 5 minutes to hydrate the cocoa.
Divide batter evenly among the liners (about two-thirds full). Tap the pan once on the counter to release larger air bubbles.
Bake 20–22 minutes, or until the tops spring back lightly and a toothpick inserted in the center comes out with a few moist crumbs attached.
Cool in the pan for 10 minutes, then transfer cupcakes to a wire rack to cool completely before frosting.
For the frosting: In a stand mixer fitted with the paddle (or using a hand mixer), beat the peanut butter and butter on medium-high until lightened and creamy, 2–3 minutes.
Reduce speed to low and add the sifted confectioners' sugar in two additions along with the vanilla and fine sea salt. Increase to medium and beat until smooth, then drizzle in the cold cream a tablespoon at a time until fluffy and spreadable, 1–2 minutes. If the frosting feels soft, chill it for 10 minutes to firm slightly.
Swirl or pipe the frosting onto cooled cupcakes. Finish with chopped peanuts, a pinch of flaky sea salt, and optional dark chocolate shavings.