So I asked my mom, an actual heart surgeon about this, and here's what she had to say:
Yes, you could survive a bullet wound to the heart if it gets lodged in the heart muscle instead of fully penetrating, which she thinks is pretty reasonable for non-modern weapons(she is NOT a weapons expert). Of course, getting shot in the heart is bad news but its not impossible to survive for awhile; if you are extremely lucky and it only grazes the heart/partially cauterizes the wound itself/gets lodged in the muscle in the right way, you might even be able to survive for hours without treatment.
TL;DR Heart Surgeon says this scenario is lucky but not unrealistic.