This post is going to cross over into the land of TMI. Just warning you now...
While I want to disagree with Pudgy, I am not a doctor, so I will never tell someone that it's a bad idea to get checked out.
That said, I discovered this ability a number of years ago (in my mid 30's). Generally, it happens to me when I am experiencing prostate stimulation. While anal play feels good, it usually doesn't get my dick hard. When my dick is being stimulated at the same time, I can cum while still soft.
Occasionally, when I am jerking off, with just the right mental stimulation, I can also make myself cum before I get completely hard. I don't usually do that, but I have to say, cumming through a flacid dick can feel great.
However, as I said, those are just occasional circumstances, so 95% of the time, I am rock hard when cumming, which is why I don't think it's necessarily a sign of erectile disfunction.