A late goal by Stevie Tosh ensured Queen of the South progressed to the quarter-finals of the Alba Challenge Cup as Dunfermline lost at home.
Stewart Kean gave Queens the lead after 12 minutes, nodding home at the end of counter attacking move.
The Pars levelled eight minutes into the second half when Joe Cardle fired into the top corner from 16 yards.
But the visitors grabbed victory in injury time as Tosh's 25-yard drive deflected past goalkeeper Greg Fleming.
Queens Mad Man of the Match - New signing McKenna had a steady game.