- Preheat the oven to 350°F (175°C) and line a muffin tin with cupcake liners. 
- Mix the dry ingredients: In a medium bowl, whisk together flour, ground pistachios, baking powder, baking soda, and salt. 
- Cream the butter and sugar: In a large bowl, beat the butter and sugar together until light and fluffy. Add the eggs one at a time, beating well after each addition. Stir in the vanilla extract. 
- Combine wet and dry ingredients: Mix in the dry ingredients alternately with the milk and sour cream, beginning and ending with the dry ingredients. Add green food coloring if desired. 
- Bake: Divide the batter evenly among the cupcake liners, filling each about 2/3 full. Bake for 18-20 minutes, or until a toothpick inserted into the center comes out clean. Allow cupcakes to cool in the tin for 5 minutes, then transfer to a wire rack to cool completely. 
- Prepare the frosting: For the frosting, beat the butter until creamy. Gradually add powdered sugar, beating until combined. Add vanilla extract and heavy cream, and beat until the frosting is light and fluffy. 
- Decorate: Frost the cooled cupcakes with the buttercream and sprinkle with finely chopped pistachios for garnish.