Melt the butter and chocolate together in a heatproof bowl or pot until smooth, then let it cool slightly.
Whisk in both sugars and the cocoa powder until the mixture is smooth and dark.
Add the eggs one at a time, whisking well after each, then stir in vanilla, sour cream, and coffee if using.
In a separate bowl, mix the flour, baking powder, and salt, then fold into the wet ingredients until just combined.
Pour the thick batter into a greased or lined 9-inch cake pan, smooth the top, and bake at 175°C (350°F) for 30–35 minutes. The edges should be set, and the center still slightly soft.
Let the cake cool in the pan for 10 minutes, then transfer to a rack to cool completely.
Ganache topping:
Heat the cream until it begins to simmer, then pour over chopped chocolate. Wait 1 minute, stir until smooth, add butter for shine, and pour over the cooled cake. Let it set before slicing.