It has happened to me only once, with a 400D and CF card. It has never happened again with that card, but then CF cards(by spec) have some very clever 'wear leveling' management firmware that may have flagged the bad memory cell(s) so they aren't written to again.
SD cards don't have this(or didn't, maybe they do now?)
The affected shot was a one-off that couldn't be redone(live subject), so I was pretty gutted.
I shot in RAW only(not +JPG) but found some software online(can't remember it now) that was able to extract an unaffected JPG image from the data. Thankfully too, as it is one of the best photo's I've ever shot.