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 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 in Paris for the first time.
"I was all over the place, I am disappointed not to win. I have a lot of regrets," admitted Federer.
"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," he said.
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," he said.


Latest News from Sports News Desk