Two cavers from the Australian National University were rescued from the Jenolan Caves west of the Blue Mountains after being trapped underground for nearly 12 hours.
The man was stuck in a hole the size of a construction helmet - so narrow that it's known to cavers as a "squeeze". One arm was ahead of him and the other behind him.
He was the fifth in a party of six to go through the hole so when he got stuck the woman caver behind him was also stuck underground. They were freed after rescuers drilled away some of the rock holding the caver.
He was trapped in the most difficult section of the labyrinthine underground system. The ANU caving club described the caves as "very pretty" but with "a world of mud".
"The man was stuck in a tight and narrow spot in the cave, with a woman behind him," Craig Gibbons, one of the SES team involved in the rescue, said.
"He had got himself in to a situation where he wasn't able to go forward and he wasn't able to go backwards so he wasn't able to go out the way he had come in," Deputy Captain David Taberner of the Volunteer Rescue Association said on Channel 7's Sunrise program.
"We went in with our team and worked to dislodge some of the rocks that he was stuck on, and also provide him some coaching. There's a bit of an art on how to move your body in certain ways because centimeters count in this game
"You're doing this in a space the size of a construction helmet. It's quite painstaking work," the VRA rescuer said.
"We entered the cave from the other side, and needed to drill small holes and chisel some of the rock wall away so we were able to free the trapped man," Mr Gibbons from the SES said.
"Once we got the man free, we handed him and the female over to paramedics, and it was great to see them both walk away from the scene safe and well despite it taking many hours to get him free."
Mr Taberner was asked what the reaction of the rescued man was. "He made it very clear that he was glad to be out," the rescuer said.
The trapped ANU cavers were in a party of six. The club didn't respond to a request for comment.
The ANU said: "ANU can confirm several members of the ANU Caving Club were involved in a rescue over the weekend.
"Fortunately no members of the club were injured. The University is relieved that all members of the club are well and safe and that no one was harmed in this incident.
"ANU thanks all first responders who were quickly on the scene and who ensured the safety and wellbeing of the club members, including the NSW SES and NSW Ambulance."
The rescuer Craig Gibbons who has been in the NSW SES for 30 years has done several cave rescues.
"About a dozen or so have been in areas known as show caves, which are more accessible," he said.
"This was my first rescue in the adventure caves - which are more dangerous as they're in much tighter areas that are difficult to access."