The man was on his way to visit his son at Cook County Jail in America. when prison guards told him that his son had been moved and to take a right at the end of the corridor.
But, as he entered what he thought was the visiting room, two steel doors shut and locked behind him.
Not realising anything was amiss, the father patiently waited for two hours on his own.
READ: GIRL ACCIDENTALLY SENDS NAKED SELFIE... TO HER DAD
He was locked in the room, where people visit the “highest classification,’’ super-maximum security prisoners for 31 hours.
Prison executive director Cara Smith said: "After about two hours he realised he was in the wrong room.
"There's about two feet of cement and two steel doors between him and the outside."
READ: WOMAN BREAKS BOTH HER LEGS WHILE ENJOYING THREESOME IN A CAR
Because the room was undergoing renovations, it had been classed as 'out of bounds' - so none of the prison workers checked it before closing off the section.
And then, even more awkwardly, prison guards failed to notice that the hapless dad hadn't signed out on the visitors list.
After screaming himself hoarse for 32 hours, the dad came up with a genius solution.
Snapping the head off one of the sprinkler alarms, fire authorities were alerted to his presence and he was set free.
WATCH: SHOCKING MOMENT COUPLE HAVING SEX ARE HIT BY A FIREWORK
Prison boss Smith told the Tribune: “We’re been looking at how and why and what went wrong.
“Multiple things obviously failed including a contractor leaving a door open while they did work in our jail.
"It was a perfect storm of circumstances that led to this horrible incident."
He added: “We’re tremendously sorry for what this man went through."