Am I confused?
I'm sure that when I was younger I saw an episode of Tales... that featured a female prisoner who befriended an old guy who worked in the prison morgue and hatched a plot where she would be buried in a coffin the next time someone died, then he would dig her up so she could escape, at the end she lit a match and realised the corpse whe was buried with was her rescuer.
I've tried googling and other people seem to remember it as a male prisoner, but I'm certain she was female. Was it from tales of the unexpected or something else please?