Fortunately there are some easy precautions to take when using whipped cream in desserts for parties or just for when you know your cupcakes will be sitting out for a little while. The easiest way to stabilize whipped cream is to add a tablespoon of cornstarch for every cup of cream. Whip the cream to soft peaks before adding the cornstarch. Beat until the peaks are somewhat firmer.
If you're sweetening your whipped cream, use powdered sugar instead of granulated; most powdered sugar has some cornstarch in it and it will have the same effect.
Cornstarch can give the cream a slightly grainy taste, however, so if you are more enterprising, try using gelatin. Soften the gelatin in a bit of warm water and stir until it dissolves, then beat into the cream before it hardens again.
• More detailed instructions for stabilizing whipped cream with gelatin
• Other tips for stabilizing whipped cream, including one that involves a melted marshmallow!