Australian-born Konta downed Petkovic 7-6 (7/2), 6-3 to book a last-16 matchup with Czech fifth seed Petra Kvitova, who routed Slovakia's Anna Karolina Schmiedlova 6-2, 6-1.
After almost two hours, 97th-ranked Konta reached the fourth round for the first time at any Grand Slam event.
It was her 16th win in a row, although many of those were in sub-WTA level events and three came in Open qualifying.
"I'm just happy to win it," Konta said. "It was definitely tough."
Also Read
And no British woman has reached the US Open final since Virginia Wade defeated Billie Jean King in the 1968 final.
But Konta, who became a British citizen in 2012, has one more less amazing feat within reach.
With another triumph, she would match American Barbara Gerken's 1981 quarter-final run as the best in US Open history by a women's qualifier.
Konta dominated the first-set tiebreaker and rolled to a 3-0 lead in the second set before Petkovic took a medical timeout for cooling and treatment for fatigue in the withering heat.
Konta squandered her fourth and fifth match points on her serve in the ninth game before breaking through on her sixth opportunity when Petkovic sent a forehand long.
"Even if she's not feeling at her best, she's one of the best competitors on the tour," 24-year-old Konta said of Petkovic.
"She didn't give it to me as you can tell by the last three games."
Konta, whose father is a hotel owner and mother is a dentist, improved to 4-3 all-time against top-20 foes, including a victory over Russian number eight Ekaterina Makarova on a run to the Eastbourne quarter-finals.
Konta reached a career high of 89th in the world rankings after Wimbledon last year.