Saved by the bell
Meaning: to be rescued from an unwanted situation
Origin: Back in the day, they would accidentally bury “dead” people so often, they connected a bell with a string from the coffin leading to the surface so a buried victim could alert gravediggers of the mistake