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).
Fourth-seeded Caroline Wozniacki won 7-6 (5), 6-1 against Lucie Safarova of the Czech Republic to reach the quarterfinals as well.
Brengle served for the match at 5-4 but Kvitova saved three match points to force a tiebreaker. Brengle took a commanding lead and won her first match over a top-10 player with a backhand passing shot.
Caroline Garcia of France, Ekaterina Makarova of Russian and Sara Errani of Italy also advanced.