Birthday boy James Milner grabbed both goals as Aston Villa reached the fourth round of the FA Cup for only the second time in eight seasons with a 2-1 victory at Gillingham.
Milner netted the winner from the penalty spot 13 minutes from time after Adam Miller was adjudged to have fouled Ashley Young in the box.
Until then, it had looked like the Gills would earn a deserved - and lucrative - replay after Simeon Jackson blasted in his 12th of the season to cancel out Milner's well-taken opener.
Martin O'Neill sent out a message of intent that his Champions League chasing side are taking the FA Cup seriously by making just three changes from the side that beat Hull.
Luke Young, Gareth Barry and Gabriel Agbonlahor sat out but the Villa side was still full of quality.
The Gills were forced to play midfielders Stuart Lewis and Mark Bentley in unfamiliar defensive roles due to bans to Barry Fuller and Garry Richards, but were able to welcome back Andy Barcham after he completed a permanent move to Priestfield from Spurs on Friday.
The home side started well but were stunned in the 13th minute when Milner netted.
The winger - who had not scored for Villa since a brace in the 8-3 Carling Cup win over Wycombe three years ago - took advantage of some hesitation from Miller to dispossess the Gills captain 25 yards from goal.
He played a neat one-two with Stiliyan Petrov and curled a fine strike past Simon Royce from the edge of the area.
Gillingham manager Mark Stimson had admitted he feared a thrashing before the game, but any fears that the Gills would cave in were soon forgotten as they dominated the rest of the first half.
The closest they came to a leveller though was an effort from Dennis Oli when his shot from Mulligan's pull back went into the side netting.
The Gills appealed for a penalty when Nigel Reo-Coker brought down Oli right on the edge of the box, but referee Keith Stroud gave just a free-kick - and a yellow card for the stand-in Villa skipper.
Jackson headed just wide after Mulligan had flicked on a John Nutter free-kick.
But Villa, who had been on the back foot since their goal, should have doubled their lead five minutes before half-time when Milner crossed for the unmarked Nathan Delfouneso but he volleyed high and wide from eight yards.
The Gills stunned their Premier League opponents by drawing level 12 minutes into the second half.
The goal came when Royce's long kick was flicked on by Mulligan and Jackson blasted home his 12th goal of the season.
However, rather than galvanising the home side and sparking a famous comeback, the goal brought Villa back to life and they pushed forward.
Delfouneso had the chance to restore the lead when he let fly from 20 yards, but his shot went just wide.
Simon King - impressive at the back for the Gills throughout - blocked a Craig Gardner shot before Zat Knight headed just over.
But Villa were to take the lead again 13 minutes from time.
Young, who endured a frustrating afternoon, broke into the box and went to ground under a challenge from Miller and Stroud pointed to the spot despite the home side's protests.
After a short delay while a new ball was brought on to the pitch, Milner stepped up and drilled his kick into the bottom left corner.
Gillingham pressed forward in search of another equaliser, but failed to create another meaningful chance, with Young and substitute Marlon Harewood almost extending the lead on the break.
By Jon Phipps, PA Sport
Aston Villa manager Martin O'Neill was a delighted - but relieved - man after
his side overcame an FA Cup banana skin at Gillingham.
He said: 'Obviously, I'm delighted we've won the game.
'I thought it was a very difficult afternoon the whole way through. If the
players didn't know beforehand they were in some game, after about 10 minutes
'We got a great goal and it settled us down a wee bit but I never felt
comfortable all afternoon. I thought that Gillingham were always in the game,
they equalised and the game was in the balance.''
After Milner's opener - which came following a good link-up with Stiliyan
Petrov - the home side had their illustrious opponents on the rack, and O'Neill
admitted he would have been satisfied with getting a replay after a tough
examination from Mark Stimson's young side.
'It was a genuine FA Cup third-round tie,'' he added.
'I thought in the end we did fine to win it but it was really tough and before
we got the penalty, I would have settled with going back to Villa Park.
'The crowd got right behind them and confidence was high within their camp.
'I've been involved in these games as a player and I think they're very
difficult. I thought it was blood and thunder and I'm just delighted to have got
Milner's second goal came from the penalty spot after Adam Miller was adjudged
to have fouled Ashley Young in the box, and while O'Neill had not seen the
decision again, Stimson felt his side had not had the rub of the green.
'It was a big decision to be made,'' he said.
'Having seen it on the TV, I've seen them given and I've seen them not given,
it's one of those in between and unfortunately for us, we didn't get the rub of
the green, they've got a penalty.
'You have to be careful when you are defending in your box. If you're going to
go for the ball, you've got to be 100% otherwise you give the decision over to
the referee and sometimes they do get them wrong. Having seen it, I think it was
harsh but it's a lesson to learn.''
Stimson - who was forced to name six teenagers on the bench - was delighted
with his side's endeavours, even if he was upset to end up on the losing side.
He said: 'I'm proud of the players first and foremost.
'I thought they did well out there today playing against a very strong Aston
Villa side and gave a good account of themselves.
'On the result, I'm frustrated, we were close to maybe getting a draw and
going back to Villa Park.''