Grease an 8 inch square metal or glass pan (cooking spray is fine).
Combine first 4 ingredients (sugar, mayonnaise, egg and vanilla) in a mixing bowl. Stir well.
Sift flour, cocoa, baking powder and salt together, then add to the mayonnaise mixture. Stir in the water and beat with a spoon or scraper until well-blended.
Transfer mixture to the baking pan and bake at 325 degrees for 30 to 35 minutes. For cupcakes, bake at 350 degrees for 15 minutes.
To make the frosting, soften to butter so that it is mushy and almost but not quite melted. Sift the cocoa powder with the confectioners' sugar. Add the confectioner’s sugar mixture and sour cream alternately to the chocolate mixture and beat with a handheld mixer until fluffy, scraping sides of the bowl. Beat in the vanilla.