Mendes swerves the ball into the net for Rangers' winner
Holders Rangers reached the quarter-finals of the Co-op Insurance Cup with an extra-time win over Partick Thistle.
Kris Boyd's stunning volley put the visitors ahead in the 25th minute after an excellent pass by Steven Davis.
But Thistle hit back eight minutes later when Stephen McKeown shot across Neil Alexander and into the net.
After a scoreless second half, Pedro Mendes struck in the 116th minute with a stylish finish past Jonny Tuffey to secure Rangers' spot in the next round.
Thistle started brightly with David Rowson firing wide early on.
In the eighth minute, Davis' long pass found Boyd in a suspiciously offside position, but Tuffey denied the visitors a controversial opener with a comfortable save.
The pace of the Rangers attack began to cause the home defence problems and Jean-Claude Darcheville found himself in a promising position after Mark Roberts had lost possession.
But the Frenchman, who was making his first start of the season, elected to pass rather than shoot and Thistle scrambled the ball to safety.
Rangers broke the deadlock in the 25th minute when Davis floated the ball onto the left foot of Boyd who volleyed high past Tuffey.
Moments later, Thistle came close to equalising through McKeown's swerving shot, which was tipped over by Alexander.
But the midfielder did get the Jags' leveller 12 minutes before half-time when Simon Storey intercepted Kevin Thomson's loose pass and found Simon Donnelly on the edge of the box.
The former Celtic striker took his time before playing the ball into the path of McKeown who fired confidently past Alexander.
Novo had two chances to put Rangers back in front before half-time but blazed over from Darcheville's pass before having his second effort saved.
The Firhill side continued to cause the visiting defence problems after the break with Roberts hooking a dangerous ball across Alexander's goal which Kirk Broadfoot nervously ushered clear.
Rangers' attempts at intricate passing moves were struggling to create meaningful openings as the home defence looked to close their opponents down at every opportunity.
McKeown celebrates his equalising goal for Thistle
With 18 minutes of the 90 remaining, Roberts' replacement Chris Turner threw himself at Marc Twaddle's tempting cross but was inches away from making the header which would have surely given his side a second goal.
The home fans claimed for a penalty when Harkins went down under the aerial challenge of Broadfoot, but referee Steve Conroy was not swayed by the protests.
Alexander made a double save in the 87th minute, first blocking at the feet of Turner before rising sharply to block Rowson's drive.
Novo then found space in the box before firing high over the bar and Tuffey was called upon to make an injury-time block from Boyd's close-range effort.
The first-half of extra time brought more frustration for Novo in front of goal with two more shots failing to trouble Tuffey.
After the restart, McKinlay volleyed wide from Harkins' knock-down before Mendes' decisive strike.
The Portuguese midfielder latched on to substitute Beasley's pass and curled the ball past Tuffey with the outside of his right boot.
Partick Thistle manager Ian McCall:
"We're devastated. Mendes' goal was a cruel blow.
"I thought in the second half of extra-time, we actually looked stronger.
"We got the goal at the right time and we had chances. I'd love to see the penalty incident with Gary Harkins, it looked a penalty.
"It was a great effort and there was a lot of good football but ultimately it came short."
Rangers assistant manager Ally McCoist:
"We scored two fantastic goals but I can't believe some of the finishing tonight, I thought we were poor in front of goal.
"We had chances to go and win the game within the 90 minutes and we didn't do that. That's something we'll have to work on.
"We knew Partick would make it very, very difficult and they deserve all the credit that's going. They played very, very well. Ian McCall's got them well organised.
"I'm just very, very pleased that we're through."
Partick: Tuffey, Storey, John Robertson, McKinlay, Twaddle, Rowson, McKeown (Chaplain 90), Maxwell, Roberts (Turner 71), Donnelly (Gray 98), Harkins.
Subs Not Used: Hinchcliffe, Kinniburgh.
Goals: McKeown 33.
Rangers: Alexander, Broadfoot, Weir, Bougherra, Papac, Pedro Mendes, Davis, Thomson, Novo (Lafferty 111), Boyd, Darcheville (Beasley 72).
Subs Not Used: McGregor, Edu, Dailly.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.