Defending champion Federer, the third seed, lost to Ukraine's world number 116, Sergiy Stakhovsky 6-7 (5/7), 7-6 (7/5), 7-5, 7-6 (7/5) in his worst Grand Slam defeat for a decade.
Sharapova, the third seed, slumped to a shock 6-3, 6-4 loss to Portuguese qualifier Michelle Larcher De Brito, the world 131.
The defeats came just two days after Rafael Nadal had exited in the first round.
They also occurred on a day when the famed grass-courts of Wimbledon came under fire after seven players either withdrew or retired with injuries.
Women's world number two Victoria Azarenka and men's sixth seed Jo-Wilfried Tsonga were amongst the casualties which eased the title paths of Serena Williams and Andy Murray.
Federer's defeat ended his run of 36 consecutive Grand Slam quarter-final appearances, having not gone out of a major before the last eight since the 2004 French Open.
It was his earliest Wimbledon defeat since he was knocked out in the first round in 2002 by Mario Ancic.
The following year he lost in the first round of the French Open to Luis Horna.
"I'm still in disbelief that it actually happened," 27-year-old Stakhovsky said.
Federer, who will be 31 next month, said: "I won't panic. I will go back to work. This wasn't supposed to happen but I will be back next year."
Sharapova's defeat out on Court Two came after she fell on three occasions and needed a medical timeout to treat a painful left hip.
The Russian's dramatic loss came on a day when there was a Grand Slam record seven withdrawals either through retirements or walkovers.
That could have been nine had Sharapova given up or even Caroline Wozniacki, a former fellow number one, had surrendered to an ankle injury picked up in a fall during her loss to Czech qualifier Petra Cetkovska also on the troublesome Court Two.
"I don't think I've ever fallen three times in a match before in my career, so that was a little strange," admitted Sharapova who was heard on the TV monitors telling umpire Alison Hughes that the court was dangerous.
"Well, after I buckled my knee three times, that's obviously my first reaction."
Larcher De Brito, based at the same Bollettieri centre in Florida, admitted the conditions had been testing.
"There's a lot of grass that's been cut that didn't get swept off so there's a lot of dead grass on the top and it made it quite slippery," said Larcher De Brito after taking victory on a fifth match point.
World number two and Australian Open champion Azarenka withdrew just minutes before she was due on Centre Court to face Italy's Flavia Pennetta.
A right knee injury, suffered in a fall during her first round win over Maria Joao Koehler on Monday, put paid to her hopes after an MRI scan showed extensive bruising to the knee.
French sixth seed Tsonga quit his match with Latvia's Ernests Gulbis with a knee injury at the end of the third set.
Also withdrawing were Steve Darcis, the conqueror of Nadal, Croatian 10th seed Marin Cilic and Kazakhstan's Yaroslava Shvedova.
John Isner and Radek Stepanek both quit during their second round matches.
Azarenka's fall happened on Court One, the same arena where Darcis fell and hurt his right shoulder in his defeat of Nadal.
"The court was not in a very good condition My opponent fell twice; I fell badly; there were some other people who fell after," said Azarenka, a semi-finalist in the last two years.
An All England Club spokesman denied the courts were dangerous.
"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," said a spokesman.
"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."
Meanwhile, Murray emerged unscathed as the world number two eased into the third round with a 6-3, 6-3, 7-5 win over Taiwan's Lu Yen-Hsun.
Tsonga and Cilic were Murray's most likely quarter-final opponents.
Murray hit 41 winners and served 11 aces to set up a last 32 clash with Spanish 32nd seed Tommy Robredo.
"I thought I kept my concentration well on serve and gave him very few opportunities after the first set," Murray said.
Two former world number ones were knocked out.
Lleyton Hewitt was dumped out by German qualifier Dustin Brown, the dreadlocked former Jamaica player winning 6-4, 6-4, 6-7 (3/7), 6-2
Ana Ivanovic was knocked out by Canada's Eugenie Bouchard, the reigning Wimbledon girls' champion, 6-3, 6-3.