Konta saw five match points come and go as Petkovic threatened a fightback, but the 24-year-old eventually sealed a 7-6 6-3 win.
The British number two went into the contest on the back of beating Garbine Muguruza in the longest ever women's match at the US Open, but she showed little signs of fatigue on the Louis Armstrong Court.
After an even start, Konta broke the serve of Petkovic on two separate occasions, but the 18th seed found instant responses to force a tie-break.
The German had the momentum, but Konta produced a brilliant few minutes of tennis, recording seven points from nine to move into the lead.
Konta soon moved into a 3-0 advantage in the second before Petkovic called for the trainer, with strapping being applied to her leg and her condition being assessed by the doctor due to the heat.
The stoppage in play didn't disrupt Konta, who recorded a second break of serve to give herself a chance to serve for a place in the next round, but it would prove to be a difficult task for a player who was looking to secure the biggest payday of her career.
Three match points went begging before she eventually dropped serve, before another two opportunities were wasted after Petkovic had got back to 5-3.
However, on the sixth opening, Petkovic hooked a forehand just long of the baseline, prompting a mixture of relief and elation from Konta, who has provisionally moved up to 58th place in the world rankings.
Two-time Wimbledon champion Petra Kvitova stands in her way in the last 16.