Saved by the bell
This expression has come to be used figuratively as a last-minute rescue from some misfortune. Its origin is from boxing during the 19th century and has nothing to do with the preposterous folkloric etymology about dead ringers being people who are mistakenly buried alive and are given life-saving bells to ring.