Sharapova knew Lucie Safarova was going to be a tough opponent going into the match - not only had Safarova won their only previous clay court meeting, but the Czech had two wins over Top 2 players, over Justine Henin at Paris [Indoors] in 2007 and Caroline Wozniacki on these very courts in 2010.
And the World No.2 had a lot of trouble - she converted just five of 19 break points and was on the court for three hours and nine minutes - but she eventually triumphed over Safarova, 64 67(3) 63.
"I knew today was going to be difficult - I was playing a good opponent with tremendous results on clay, and in general she's not an easy opponent to play against," Sharapova said. "I needed to be ready. And there were some things I was disappointed with - I don't think I took advantage of some of the shorter serves she hit, especially on her second serve - that's something I'll definitely be working on.
"But no matter how long it took today, I'm happy I got myself through this match."
Sharapova actually rallied from 5-2 down to push the second set to a tie-break. "I feel like I had the momentum going into the tie-break in the second set - I wasn't able to close it out, but when it comes to a third set you just have to start from scratch again. I thought about what was working well for me before the tie-break and in the first set too, and tried to do those things again. It was a good effort."
Next up for Sharapova will be Ana Ivanovic, who beat No.8 seed Nadia Petrova earlier in the day, 64 63, rallying from 4-2 down in the first set and an early break down in the second set as well. It was an upset in terms of ranking, but not in head-to-head - Ivanovic is now 9-5 lifetime against Petrova.
Sharapova leads Ivanovic in their head-to-head series, 5-2. The pair is tied on clay, 1-1.
The feature night match saw Sabine Lisicki bomb 11 aces to edge Jelena Jankovic in a tight two-setter, 76(3) 75. Jankovic's fighting spirit was evident in the later stages of both sets - Lisicki had 5-3 leads in both sets before Jankovic pushed them both into overtime - but Lisicki's aggressive game was just too much at the business end of them, her mix of raw power and variety just too tough for the Serb.
"I'm really happy to be in the quarterfinals," Lisicki commented. "I'm having so much fun out there at the moment and playing more freely - drop shots, slice, power points - it's the way tennis should be!
"It's so special for me to play well in Germany."
Lisicki Vs Jankovic Video: Lisicki Interview
Lisicki may not have waited up to find out her next opponent, as No.4 seed Sara Errani and American qualifier Bethanie Mattek-Sands played until after 1:30am in the last match of the day, with a very aggressive Mattek-Sands coming good in that one, 60 46 61, playing exceptional tennis in the first and third sets - for the match she put together a +18 differential of 49 winners to 31 unforced errors.
"I've played a couple of matches in my day that have finished pretty late, but this is possibly the latest," Mattek-Sands commented. "But this is a great win, one of the best of my career. Obviously Sara is an unbelievable player on clay and I fought through a third set, so I'm happy with my performance.
"I'm feeling good. I'm feeling fit. I've played a lot of matches here already. I'm happy that I'm recovering. I think my movement has improved and I'm playing aggressive - I'm playing my game."
Mattek-Sands Vs Errani Video: Match Highlights
Mattek-Sands beat Lisicki in the pair's only previous meeting, at the French Open last year.