52-year-old New Jersey resident Dennis Hennis is recovering in hospital after the freak accident, which happened last Saturday (March 31) as he was attempting to clear a jam in his nail gun.
BBC News reports that the self-employed builder was working on his neighbour's roof when the gun jammed, and during his attempts to clear it he accidentally shot a four-inch (10cm) nail straight into his heart.
Hennis went into cardiac arrest after the bullet pierced the right side of his heart, and underwent surgery after being airlifted from hospital to a dedicated trauma centre.
His surgeon Dr Michael Rosenbloom explained: "Imagine there is a nail in the heart and they have to do CPR. It turns a little puncture wound into a laceration."
Dr Rosenbloom credited Hennis's survival not only to the swift medical attention he received, but to the fact that he knew not to try and remove the nail himself.
Hennis said: "I've already won the lottery. I got a new grandson on my birthday on March 23, and a week later I'm almost dead.
"Now we can celebrate birthdays together."
Hennis is expected to make a full recovery, and should be discharged in time to spend Easter with his family.