After Diomansy Kamara opened the scoring for the visitors, David Graham's strike and Andy Kirk's penalty put the home side ahead before Hoops' striker Morten Rasmussen gratefully levelled two minutes from the interval.
But when Keane came on for Marc Crosas at the start of the second half, Celtic strode away.
The Fifers' resistance crumbled in the second half after defender Callum Woods scored an own goal under pressure from Rasmussen, then Keane scored from the spot with his first goal for the club to ensure a safe passage into the next round.
Dunfermline, as expected, tried to unsettle Celtic early on but the SPL side's class came to the fore in the 19th minute when Kamara gave the visitors a deserved lead.
Bhoys debutant Edson Braafheid left Willie Gibson down the left-hand side and his cutback was crashed off the bar by Georgios Samaras.
The Fifers failed to clear their lines and when the ball eventually fell to Kamara, he thundered a shot from the edge of the box high past Pars goalkeeper Greg Fleming.
However, Celtic's joy was short-lived as less than two minutes later, Nick Phinn found space on the right to cut the ball back for Graham to slide in the equaliser.
The goal stunned the visiting support but there was more drama in the 26th minute when the home side forged ahead through a Kirk penalty.
Celtic defender Paul Caddis was adjudged by referee Charlie Richmond to have pushed Steven Bell in the back as he awaited a Phinn cross and when the Celtic protests died down, the Irishman sent Artur Boruc the wrong way from the spot.
The Glasgow giants wavered for a few moments before reasserting themselves but Dunfermline scrapped and fought to keep their lead intact.
There was scare for the home side six minutes from the break when midfielder Alex Burke was short with a backpass which had Fleming racing from his goal to clear with Rasmussen ready to pounce.
As Mowbray's side stepped up the pressure, Pars stopper Neil McGregor and Fleming did well to block from the Dane after the keeper had spilled a Caddis cutback from the right.
However, in the 43rd minute Rasmussen got Celtic back level when he scooped the ball in from close range at the second attempt, after Parkhead skipper Scott Brown's effort fell kindly to the former Brondby striker.
Keane was welcomed by the travelling support when he appeared at the start of the second half.
The visitors, effectively playing with four strikers, swarmed over Dunfermline and in the 54th minute Fleming pulled off a great close-range save from Rasmussen after he could only parry Keane's cutback.
Fleming made another decent save moments later, this time from Keane, after the Republic of Ireland player had weaved his way into a shooting position inside the Fifers' penalty area.
But in the 58th minute, after Fleming had foiled Keane again, Celtic regained the lead when Kamara's cross from the right was turned into his own goal by Woods, with Rasmussen in close attention.
Keane got his first goal for the Hoops in the 67th minute although he had to rely on a dubious penalty, awarded when he was tackled inside the box by Pars skipper Austin McCann.
The Irishman calmly sent Fleming the wrong way from the spot before taking the acclaim of the Celtic fans behind the goal.
McGeady replaced Kamara and Zheng Zhi came on for Caddis as the visitors piled forward looking for more goals.
There were no more goals despite some huffing and puffing by Celtic - and after an unconvincing first 45 minutes Mowbray will have been glad to avoid another slip-up.