The 17-year-old fell from a tree near Sanquhar shortly after 2 am yesterday, breaking his leg, pelvis and ribs and puncturing his lung.
Police Scotland, the ambulance service and a rescue helicopter from Prestwick were called to the scene but were unable to reach the teen due to the steep-sided gorge and thick trees.
A police spokesman said a helicopter winchman was able to get down to the casualty and stay with him but not remove him to safety.
Four members of the Moffat Mountain Rescue Team (MMRT) and technical equipment were lifted by the helicopter and flown to the scene at around 3 am, with more members following by vehicle to the remote farm location.
A spokesman for MMRT explained the team set up a technical lower to get a stretcher to casualty, who was being tended to by the winchman paramedic from the helicopter and a member of the Scottish Ambulance Service.
Once the casualty was safely in the stretcher and stabilised the team raised the stretcher up a steep gorge and then carried it to the helicopter.
He was then taken to Dumfries and Galloway Royal Infirmary at about 6 am.
Deputy team leader of Moffat MRT James Coles said “The casualty was in a difficult to access area in a steep gorge.
“The extraction of the casualty involved setting up rope systems to protect the stretcher and the team for a tricky rescue in the dark.
“The team worked with personnel from Police Scotland, Scottish Ambulance Service and the rescue helicopter to achieve a safe rescue of the casualty.
“We hope he makes a speedy recovery in hospital.”