Top-seeded Angelique Kerber also reached the quarterfinals, downing Alexandra Cadantu of Romania 6-1, 6-0 in just 50 minutes. Kerber was broken while serving for the first set but was otherwise hardly challenged by the 72nd-ranked Cadantu, who scored just eight points in total on her own serve.
"I felt really well on court,'' the 10th-ranked German said. "I was very relaxed and played well from the start.''
The 12th-ranked American Stephens won just two of the first 14 points and fell behind 5-2, but she saved three set points before taking the opener in a tiebreaker.
"I let out some screams, which I normally don't do,'' Stephens said about her slow start. "I am just happy to get through.''
Stephens went up 3-1 in the second set before Petkovic reeled off 10 straight points and got back into the match.
Stephens managed an early break in the third set, and the Australian Open semifinalist closed out the victory on her third match point.
Stephens next plays Stefanie Voegele of Switzerland, who rallied to defeat Karin Knapp of Italy 4-6, 6-2, 7-5 to advance to her first quarterfinals since April.
Earlier, Dominika Cibulkova of Slovakia routed Katarzyna Piter of Poland 6-0, 6-1 in less than 53 minutes. Piter, playing in her first main draw of the year, broke the seventh-seeded Cibulkova in the second set for her only game.
In her fourth quarterfinal of the season, one-time finalist Cibulkova will take on two-time former champion Ana Ivanovic.
Also, Patricia Mayr-Achleitner of Austria missed two match points at 5-3 in the second set before defeating Maryna Zanevska of Ukraine 6-1, 6-7 (1), 6-4 to set up a quarterfinal against Kerber.
Kerber is one win short of securing the eighth and final spot at the season-ending WTA Championships in Istanbul.