Last minute reprieve. ‘Bell’ is used in the case of a school or work bell signaling the end of school or work time. The popular example is a teacher asking a difficult question of a student, but the end of school bell rings so the student does not have to answer, hence the idiom. (Compare to Down to the wire.)
“My neighbor talks too much and I can’t walk away. Luckily, the other day the phone rang and I had to excuse myself. I was saved by the bell.”