Stoke boss Mark Hughes expressed his relief at his side making it through to the FA Cup fourth round having been sure they were headed for an embarrassing defeat to Conference outfit Wrexham at the Britannia Stadium.
The Potters - their crossbar already rattled by Wes York's shot around the hour mark - fell 1-0 behind in the 73rd minute of the third-round tie through Mark Carrington's header.
With the lead nothing more than the visitors deserved, a major upset appeared very much on.
But the Premier League hosts managed to avoid falling victim to a giantkilling with a dramatic late turnaround as Marko Arnautovic equalised in the 80th minute, following up a parried effort from substitute Peter Crouch, before another substitute Stephen Ireland struck in the 88th and stoppage time to seal a 3-1 win.
When asked afterwards if he had feared the worst at 1-0, Hughes - who used to support Wrexham as a boy - said: "At that point, I thought we were going out to be perfectly honest.
"Wrexham were good value and we hadn't produced anything of real note. It didn't really look like we were going to either.
"But thankfully we had made a couple of changes and that helped us. I didn't really want to involve Peter Crouch or Jonathan Walters today, but we needed their understanding of what was required.
"We were able to get back level quickly, which was important, and then Stephen Ireland comes on and produces that craft I talk about time and time again.
Ireland, out recently due to a knee problem, was playing his first game since early December and his goals broke his scoring duck for the season.
And of the midfielder, Hughes added: "Those goals were important.
"Stephen has been really unlucky - he arguably started pre-season in the best form of anybody, then got injured, went out of the team and found it hard to get back in, then got injured again. So it has been stop-start for him.
"But hopefully this year might be a bit more productive for him.
"He will always get you a goal - he is a good finisher and will be encouraged by that."