I used Recuva the last (and only) time it happened. It is a free program from the same people that do CCleaner (Crap Cleaner). Use it on a PC and extract the files to some place on your hard drive where they will be easy to reorganize. You don't have to rename anything, and as long as you haven't written anything to the card after the glitch, the only thing you lose is the folder structure. One of the first options in the recovery wizard is to recover files from a card.
It can be found here:
http://www.recuva.com/download
If it works well (and it will) I suggest you donate.
I now back up my storage card whenever I change something on it intentionally and since I started doing this I have not had need for the backups.