Saved by the bell
Saved by a last minute intervention.
This is boxing slang that came into being in the latter half of the 19th century. A boxer who is in danger of losing a bout can be 'saved' from defeat by the bell that marks the end of a round. The earliest reference to this that I can find is in the Massachusetts newspaper The Fitchburg Daily Sentinel, February 1893:
"Martin Flaherty defeated Bobby Burns in 32 rounds by a complete knockout. Half a dozen times Flaherty was saved by the bell in the earlier rounds."
There is a widespread notion that the phrase is from the 17th century and that it describes people being saved from being buried alive by using a coffin with a bell attached. The idea being that, if they were buried but later revived, they could ring the bell and be saved from an unpleasant death. The idea is certainly plausible as the fear of burial alive was and is real. Several prominent people expressed this fear when close to death themselves:
"All I desire for my own burial is not to be buried alive." - Lord Chesterfield, 1769.
"Have me decently buried, but do not let my body be put into a vault in less than two days after I am dead." - deathbed request of George Washington.
"Swear to make them cut me open, so that I won't be buried alive."- Frederic Chopin's last words.
Just as real were the devices themselves, several of which were patented in England and the USA. These were known as 'safety coffins' and designs were registered in the 19th century and up to as late as 1955; for example,
The Improved Burial Case. Patent No. 81,437 Franz Vester, Newark, New Jersey. August 25, 1868.
There's no evidence to show that these coffins were ever put to use though and there's a similar lack of evidence of the phrase ever being used in that sense prior to it having been used in boxing circles.