Underbaking is a possibility – although you are testing clean with a toothpick, also just tap the top of the cupcake with your finger and see it it springs back. If it doesn’t it will most likely deflate when you take it out – that’s what used to happen to me. Also, don’t overfill – I use an icecream scoop and always level the top and have noticed when I don’t, my cupcakes are overfilled and not only take too long to bake and end up browning too much on the bottom but they usually deflate too. Finally, check your recipe for the ratio of baking powder to flour. Good rule of thumb is 1 tsp baking powder (or 1/4 tsp baking soda) per cup of flour. If the recipe has too much leavening, it will over inflate in the oven and becomes unstable, resulting in a deflated cupcake once it cools down. Good luck and let us know how it worked out on your next baking attempt.