Ernests Gulbis condemned Roger Federer to his worst French Open defeat in a decade on Sunday as Novak Djokovic remained calmly on course for a maiden Roland Garros title.
Gulbis, the controversial Latvian, beat the fourth seeded 2009 champion 6-7 (5/7), 7-6 (7/3), 6-2, 4-6, 6-3 as Federer, 32, suffered his earliest loss in Paris since 2004 when he was demolished in the third round by Gustavo Kuerten.
Victory on Sunday would have put Federer into a record 42nd Grand Slam quarter-final and 10th in a row in Paris, but 25-year-old Gulbis showed no fear as he set up a last-eight clash against Czech sixth seed Tomas Berdych.
He unleashed 13 aces and 53 winners with Federer undone by an uncharacteristic 59 unforced errors as he lost a five-setter at Roland Garros for the first time.
"I was all over the place," admitted Federer. "I am disappointed not to win. I have a lot of regrets.
"But he did a good job of hanging around and coming back. I knew what to expect, I know how he plays. I just wish I could have played better."
Gulbis, who took a controversial medical timeout at 2-5 down in the fourth set, was delighted by his win.
"It's the biggest win of my career," said the Latvian, whose only other Grand Slam quarter-final appearance came in Paris in 2008.
"It was a tough match and I'm sorry as I know that most of you wanted Roger to win."
Gulbis, the 18th seed, was a break ahead in the first set at 4-2 before Federer retrieved it in the seventh game. The Latvian was also a mini-break to the good in the tiebreaker but still could not convert.
After surrendering the advantage of an early break again in the second set, Gulbis was warned for breaking his racquet by stamping it into the Paris dirt.
However, his pressure on Federer eventually yielded rewards in the second set tiebreak and then in a one-sided third set.
Federer wasn't finished as Gulbis, as so often in his colourful career, went spectacularly off the boil with the Swiss levelling the contest by taking the fourth set.
The Latvian incurred the wrath of the pro-Federer centre court crowd when he took a medical timeout to treat lower back pain at 2-5 down.
"I'm honest, I'm not big on medical timeouts. I don't like to take it, but I take it when it's really necessary. It probably was my third medical timeout in my life," said Gulbis who thrived on the atmosphere, upping the pace as he took a 3-0 lead in the decider.
Gulbis set up two match points with his 13th ace and claimed his famous victory when Federer slapped a backhand wide.
Djokovic, the 2012 runner-up who needs a French Open title to complete a career Grand Slam, swept into the quarter-finals with a one-sided 6-1, 6-4, 6-1 win over top home hope Jo-Wilfried Tsonga.
"It was a very good match for me. I prepared well tactically with my team," said world number two Djokovic. "I started with much intensity and quality and I am very happy with my game today."
Eighth seed Milos Raonic became just the fourth Canadian man in history - and first in the Open Era - to reach a Grand Slam quarter-final when he defeated Spain's Marcel Granollers 6-3, 6-3, 6-3.
Berdych made the quarter-finals for the second time with a 6-4, 6-4, 6-4 win over 10th seed John Isner who was bidding to become the first American to reach the last eight since Andre Agassi in 2003.
"There were quick breaks in each of the sets. That's something which really helps through all the match, especially with a guy like John," said 2010 semi-finalist Berdych.
Wimbledon champion Andy Murray battled to a four-hour 3-6, 6-3, 6-3, 4-6, 12-10 win over Philipp Kohlschreiber to reach the fourth round.
The British seventh seed, who next faces Spanish left-hander Fernando Verdasco, had been level at 7-7 with the German 28th seed when the match was halted on Saturday night.
When the pair reappeared, Murray squandered a match point at 9-8 but wrapped up the match in the 22nd game of the decider in a clash which featured 18 breaks of serve and 123 unforced errors.
It was the longest fifth set of Murray's career and the first time he had been taken the full distance since defeating Verdasco from two sets to love down in last year's Wimbledon quarter-finals.
The 30-year-old Verdasco, seeded 24, reached the fourth round with a 6-3, 6-2, 6-3 win over France's 12th seed Richard Gasquet.