Pablo Zabaleta struck a late winner as Manchester City battled through to a place in the FA Cup fifth round at the expense of Stoke.
The Argentinian stabbed home from close range with five minutes of a tight contest remaining, securing a first win at the Britannia Stadium in seven visits.
Yet victory may still have come at a cost for Roberto Mancini's men after captain Vincent Kompany limped off in the first half.
City are already short on defenders with Kolo Toure at the Africa Cup of Nations, and Kompany's absence saw the controversial three-man back line deployed again.
City had the better chances in the game with David Silva hitting a post and Stoke may have been lucky not to have Glenn Whelan sent off for a bad tackle on Javi Garcia.
The visitors made a bright start as Carlos Tevez found space and fired in a shot from a tight angle but Thomas Sorensen, getting one of his usual cup outings, saved at his near post.
City also made a goalkeeping change as Joe Hart was rested and Costel Pantilimon given a chance.
The Romanian had an uncomfortable moment early on when he dwelt too long on the ball and carelessly conceded a throw-in, but he made amends by punching away Ryan Shotton's long delivery.
Stoke had their first opportunities when Whelan had a volley blocked and Robert Huth headed over from the resulting corner.
City enjoyed a period of control starting as Tevez broke from deep and beat two challenges to set up Edin Dzeko, whose effort was brilliantly blocked by Ryan Shawcross.
James Milner took a quick free-kick after Andy Wilkinson was penalised for handball and Stoke were caught napping as Silva curled a fine shot against the far post from the corner of the area.
Tevez sliced wide after another good City move but Mancini's side did survive a scare when Shawcross struck from a free-kick only to be given offside.
Matthew Etherington's cross had found its way to the defender in front of goal but the flag had clearly been raised before he turned the ball past Pantilimon.
City suffered a serious blow just after the half-hour when Kompany signalled that he could not continue with what appeared to be a leg injury.
The Belgian limped off down the tunnel and was not immediately replaced.
Garcia temporarily dropped back into defence and it was around seven minutes before Mancini, with no senior centre-back to call upon, sent on Gael Clichy and reorganised his back line.
It meant a return to the much-debated three-man defence, the cause of much anxiety earlier in the campaign, particularly in the doomed Champions League challenge.
The changes slowed City down and Stoke began to impose their physicality.
That appeared to go over the top early in the second half when Whelan jumped in two-footed on Garcia, who was left needing treatment, but referee Howard Webb felt no card necessary.
City went close when Gareth Barry headed over from a corner but the game became rather scrappy with chances few and far between.
Whelan struck a good shot from distance but Pantilimon saved comfortably low down.
Mancini sent on Sergio Aguero in the hope of giving his side more of a cutting edge and Barry did get behind the Stoke defence only to run into Sorensen.
Dzeko struck a good effort from the left but had it deflected wide before Aguero fired a powerful shot into the side-netting.
Stoke also freshened up their attack as Cameron Jerome and Peter Crouch entered the fray in search of a late winner.
Crouch immediately made his presence felt as he stood above Joleon Lescott to reach a Shotton cross but headed narrowly over.
And Stoke were made to pay as Zabaleta found himself in the right place to snatch the winner five minutes from time.
Aguero and Silva combined outside the area and the ball was played in for Dzeko, whose touch may have been unintentional but proved a perfect pass for Zabaleta, who smashed home unchallenged six yards out.
Stoke pressed until the end but Jerome skied a good opportunity just as the game went into five minutes of injury time.