Federer, the seven-time Wimbledon winner, lost a second-round match to a player who had never beaten a top-10 player in 20 previous tries.
"I'm still kind of in disbelief that it happened," the 116th-ranked Stakhovsky told ESPN afterward. "I couldn't play any better today."
The loss ended Federer's streak of 36 straight Grand Slam quarterfinal appearances.
"It's very frustrating and very disappointing," Federer said. "But I'm going to accept it and move forward."
Federer said the tournament's ban of the orange-soled shoes he wore in his first-round win had no effect on Wednesday's match.
(Sharapova struggled with her footing in Wednesday's upset loss. Video via ESPN)
Wimbledon updates: Sharapova loses to 131st ranked player
Maria Sharapova, the women's No. 3 seed, was stunned on Wednesday by Portugal's Michelle Larcher de Brito 6-3, 6-4. It took five match points for Sharapova to ultimately fall, but the win marks a massive upset and opens up the field significantly for top seed Serena Williams.
Larcher de Brito was ranked 131st in the world coming into Wednesday's second-round matchup. Sharapova was the 2004 Wimbledon champion.
Sharapova slipped a few times on the grass courts and even had to seek medical attention from a trainer in the second set.
Her loss was the second monumental upset after Rafael Nadal was defeated on Monday.
Tsonga becomes seventh player to withdraw from tournament
Jo-Wilfried Tsonga, the No. 6 seed, joined the growing list of those who've withdrawn from competition at Wimbledon after he removed himself following a knee injury.
Tsonga was in the fourth set against Ernests Gulbis, down two sets to one.
In total, seven players withdrew from competition on Wednesday, including Radek Stepanek and No. 10 seed Marin Cilic. Yaroslava Shvedova also removed herself from the women's portion.
Richard Lewis, chief executive of the All England Club, issued this statement:
“There has been a high number of withdrawals at The Championships today and we sympathise with all the players affected. The withdrawals have occurred for a variety of reasons, but there has been some suggestion that the court surface is to blame. We have no reason to think this is the case. Indeed, many players have complimented us on the very good condition of the courts.
“The court preparation has been to exactly the same meticulous standard as in previous years and it is well known that grass surfaces tend to be more lush at the start of an event. The factual evidence, which is independently checked, is that the courts are almost identical to last year, as dry and firm as they should be, and we expect them to continue to play to their usual high quality.”
Isner, Darcis and Azarenka all withdraw from Wimbledon
After upsetting Rafael Nadal in straight sets at Wimbledon on Monday, the 135th-ranked player, Steve Darcis, was forced to pull out of the tournament citing a right shoulder injury, the Associated Press reported.
Darcis, who defeated No. 5 Nadal in straight sets, withdrew from the tournament only a few hours before he was set to face Lukasz Kubot in the second round.
Darcis largely overpowered Nadal, but the two-time Spanish champion struggled due to an ailing left knee.
John Isner, the No. 18 seed and the man known for winning the longest match in the sport's history, was also forced to withdraw after landing awkwardly on his left knee early in his second-round matchup against Adrian Mannarino.
The injury occurred on a serve early on, and Isner called a medical timeout to evaluate his knee and have it wrapped. He eventually lost the second game and removed himself after just the first point of the third game.
“It didn't pop,” Isner said. “It just grabbed, like, really badly, and I knew I was in serious trouble then. I mean, I knew at that point it was not likely I was going to be able to play.”
On the women's side, No. 2 seed Victoria Azarenka withdrew minutes before her second-round match against Flavia Pennetta on Centre Court.
Azarenka suffered a serious fall in her first-round win over Portugal's Maria Joao Koehler , injuring her right knee after she did the splits.
She recovered enough to close out the win 6-1, 6-2 but felt her knee injury was too serious to continue on Wednesday.
For more updates from Wimbledon, follow Mike Singer on Twitter @RealMikeSinger.