The top-seeded Russian won four straight games to clinch the first set. But she made some errors to drop the second, and faded in the third. Sharapova had a first-round bye. She held a 13-0 record in Stuttgart before the loss.
Sharapova will lose the No. 2 ranking in the world to Simona Halep of Romania when they are updated on Monday.
Earlier, Madison Brengle of the United States upset third-seeded Petra Kvitova, 6-3, 7-6 (2), and fourth-seeded Caroline Wozniacki won, 7-6 (5), 6-1, against Lucie Safarova of the Czech Republic to reach the quarterfinals as well.
Rafael Nadal's clay-court woes mounted at the Barcelona Open with another loss. The eight-time champion fell to Fabio Fognini, 6-4, 7-6 (6), in the third round, a year after his 41-match winning streak in Barcelona ended in the quarterfinals.
After dropping the first set, Nadal appeared to have rebounded by breaking the Italian three times in the second set, but Fognini answered each time.
In the tiebreaker, Nadal trailed 6-3 but came back to 6-6. Fognini went ahead, and Nadal drove a shot long for only his third loss at the tournament.
Nadal has failed to reclaim his title at two tournaments he has won a record eight times, casting doubt on his ability to defend the French Open title. Nadal's next tournament will be in two weeks in Madrid.
Nishikori will next play Roberto Bautista Agut after the Spaniard defeated 10th-seeded Pablo Cuevas, 7-6 (5), 6-2.
Ferrer will meet Philipp Kohlschreiber after he ousted Benoit Paire of France, 6-4, 7-6 (6). Martin Klizan of Slovakia also joined the final eight after ending Victor Estrella's strong start to the tournament with a 6-4, 6-3 victory. Klizan will meet Tommy Robredo in the final eight after he dispensed with Marcel Granollers of Spain, 6-2, 6-2.
Top-seeded Simon converted three of his five break points in winning the pair's 10th meeting 7-5, 6-4, as he improved his record in Bucharest to 19-3, having won the trophy in 2007-08 and 2012.
Countryman Gael Monfils, the second seed, beat Mikhail Youzhny of Russia 6-1, 6-2 for the first time in four matchups. Monfils will next face eighth-seeded Simone Bolelli of Italy, who advanced to the quarterfinals for the third time this year by beating Andreas Haider-Maurer of Austria 6-4, 6-4.