LONDON (AP) -- Chelsea came from behind three times against Manchester United on Wednesday before a nine-goal thriller was settled by Ramires' extra-time shot clinching a 5-4 victory and a spot in the League Cup quarterfinals.
Three days after losing an acrimonious Premier League encounter to United, Chelsea was heading out of the tournament until Eden Hazard scored from the penalty spot in 90th minute to make it 3-3.
In extra time at Stamford Bridge, Daniel Sturridge and Ramires gave Chelsea an apparently comfortable lead - until Ryan Giggs scored his second of the night for United, and the game's third penalty, in the 120th minute.
"They showed a big, big heart and passion and pride to not want to lose this game,'' Chelsea manager Roberto di Matteo said.
"It was a very exciting game of football to watch, typical cup game, quite open at times and a lot of mistakes from both teams because there were probably a lot of young players involved.''
Chelsea will now travel to Leeds in the quarterfinals.
Also Wednesday, Liverpool's title defense ended when manager Brendan Rodgers' former club Swansea won 3-1 at Anfield to set up a last-eight match against Middlesbrough.
Norwich beat Tottenham 2-1 and will play Premier League rival Aston Villa. In the other quarterfinal match drawn Wednesday, Arsenal will travel to Bradford.
Chelsea was hosting United only three days after losing 3-2 in an acrimonious Premier League encounter that led to another racism investigation in English football being opened.
United fans unfurled a banner at Stamford Bridge on Wednesday backing referee Mark Clattenburg, who has been accused by Chelsea of directing "inappropriate language'' at midfielder John Obi Mikel on Sunday that has led to police opening a racism investigation.
Despite the intense focus on him, Mikel started against Chelsea but was withdrawn at halftime after being booked for a foul on United striker Danny Welbeck.
The first half hadn't gone Chelsea's way, with sloppy defending helping United hit the front.
Oriol Romeu was robbed of possession by Anderson after a short clearance from goalkeeper Petr Cech. Anderson quickly released the ball to Giggs, who swept home from outside the penalty area in the 22nd minute.
On the half-hour, though, defender Alexander Buttner tripped Victor Moses in the penalty area and David Luiz scored from the penalty spot.
The game was then disrupted twice. Firstly, when a firework appeared to be thrown from among the 6,000 United fans, and then when a supporter ran on to the pitch.
United went back in front before halftime when Luiz gave the ball away near the halfway line to Anderson, who released Hernandez. The Mexico striker darted into the penalty area and poked the ball into the net through a narrow gap.
An entertaining start to the second half was highlighted by Nick Powell's strike being turned around the post by Cech, before Cahill sent a bullet header over the line to draw Chelsea level in the 52nd.
United was pegged back for just seven minutes, Nani restoring the visitors' lead by lifting the ball over Cech after completing a neat one-two with Anderson.
Hernandez was made to pay for lifting the ball over and squandering a chance to extend United's lead when Scott Wootton pushed Ramires over in the penalty area in stoppage time. Eden Hazard scored a dramatic late equalizer from the spot.
"We've thrown it away, really,'' United manager Alex Ferguson. "We've got possession of the ball in the last third of the field in the last seconds of the game. Nani tried to beat a player. We lost the ball and lost the game.''
Wootton blundered again on his full debut in extra time. The 21-year-old defender headed a clearance from a long ball straight into Sturridge's path, allowing the striker to round goalkeeper Anders Lindegaard before slotting the ball into the net.
In the 26th minute of extra time, Hazard's trickery helped unpick the United defense before the Belgium midfielder released Ramires to score Chelsea's fifth goal.
In the final minute, Cesar Azpilicueta fouled Hernandez and Giggs made it 5-4 from the penalty spot, but there was no time for a United comeback.
"It's just about putting a smile on the fans' faces again because I feel that they were disappointed after the weekend,'' Sturridge said.
At Anfield, Chico Flores and Nathan Dyer put Swansea 2-0 up and, although Liverpool substitute Luis Suarez pulled one back, Jonathan de Guzman sealed the win for the south Wales club.
"We were too slow, there was no tempo in the first half,'' said Rodgers, who left Swansea to take over from Kenny Dalglish at Anfield in June.
At Norwich, Gareth Bale puts Tottenham in front in the 66th, but Jan Vertonghen scored an own goal in the 84th to put the hosts back in contention.
Simeon Jackson tapped in Norwich's winner. Tottenham striker Clint Dempsey missed a late penalty.