Ill for the past week, Harper hit a tying, two-run homer in the ninth inning, then delivered a sacrifice fly in the 10th that sent the Washington Nationals over the Cardinals 4-3 Monday.
"I felt pretty good at the plate," Harper said. "Body doesn't feel very good. Just trying to grind every single day and not try and worry about it. But coughing, hacking, all that good stuff."
Washington got back to .500 and pulled within 7 1/2 games of NL East-leading Atlanta and 3 1/2 games of Philadelphia after both lost.
The playoff-contending Cardinals have dropped three in a row for the first time since July 11-14.
The Cardinals led 3-1 with one out in the ninth when Harper hit his 31st home run, sending a 96 mph fastball from closer Bud Norris over the center field fence.
Mark Reynolds led off the Washington 10th against Chasen Shreve (1-1) with a double that went in and out of right fielder Tyler O'Neill's glove. Pinch-runner Michael Taylor moved to third on Adam Eaton's bunt single and an out later, Harper flied to deep left. Taylor slid in safely, well ahead of Marcell Ozuna's throw.
"Just trying to get it in," Harper said. "I know nobody wants to play extra innings in here. Real hot out there today, so just trying to get the run in any way possible."
It was the second rough outing in a row for Norris, who gave up three runs and two homers in the 10th inning of Sunday's 6-4 loss to Cincinnati.
"I pound the strike zone, and I've walked the both leadoff guys in situations right there and that's not helping me," Norris said. "It's hard this late in the year, but I have to be better. I have to make better pitches. He hit it, so I have to give him credit for that, but I have to make better pitches and get ahead of hitters."
St. Louis manager Mike Shildt said Norris, who has converted 28 of 33 save opportunities, is unlikely to be available Tuesday after pitching on consecutive days.
"He's done a nice job for us all year, and you have to ride though some stuff with guys occasionally," Shildt said. "Clearly, we'll evaluate as we go. But it just wasn't his day the last couple of days, and I know he feels as bad as anybody in the clubhouse."
Greg Holland (2-2) pitched two scoreless innings to earn the victory against the Cardinals, who designated him for assignment July 27. It was his longest outing since a two-inning appearance for Kansas City on May 12, 2015.
Cardinals starter Jack Flaherty went five innings, giving up a solo homer to Trea Turner in the first. He loaded the bases with two outs in the fifth, but coaxed Ryan Zimmerman to fly out. Flaherty struck out five and walked five.
Washington's Max Scherzer settled in after needing 33 pitches to get through a two-run first. He eventually retired 12 in a row, a stretch halted when Yairo Munoz led off the sixth with his seventh home run.
Scherzer pitched seven innings, allowing four hits while striking out 11. It was his 15th outing with at least 10 strikeouts this season. He has a major league-leading 260 strikeouts for the year, his fifth consecutive season with at least 250.
Cardinals: RHP Adam Wainwright (elbow inflammation) will come off the disabled list and start Sept. 10 against Pittsburgh, Shildt said. Wainwright (1-3, 4.00 ERA) has not started since May 13 and has made only one major league appearance since April 17. ... St. Louis recalled RHP John Brebbia from Triple-A Memphis. Brebbia struck out the side while working a scoreless sixth.
Nationals: Matt Wieters (groin) struck out as a pinch hitter in the eighth before remaining in the game to catch. He has not started since leaving Friday's game and did not play Sunday.
Washington reliever Justin Miller entered with the bases loaded and none out in the eighth, but induced a double play grounder on his first pitch before striking out Ozuna to end the threat.
"Normally I get myself in that situation," Miller said of wiggling out of the jam.
Cardinals: RHP Miles Mikolas (13-4, 2.96 ERA), who gave up four runs in seven innings to Washington on Aug. 13, gets the start as the three-game series continues.
Nationals: RHP Erick Fedde (1-3, 5.79), who has not pitched since leaving his July 4 start against Boston with shoulder inflammation, will come off the disabled list to face St. Louis.
Twins' Miguel Sano out after cutting foot celebrating Dominican title
Twins third baseman Miguel Sano will miss at least the first week of full-squad workouts after he cut his foot while celebrating his team winning the Dominican Winter League championship.
Remembering Dodgers legend Newcombe
Tony Kornheiser and Michael Wilbon pay homage to Dodgers pitching great Don Newcombe, who died at 92.
Rob Manfred: Slow free-agent market might be 'much ado about nothing'
Hours after Manny Machado agreed to a $300 million, 10-year deal with San Diego, MLB commissioner Rob Manfred said the slow free-agent market is "a little much ado about nothing if in fact those players all sign at the end of the day."
Cardinals' Carlos Martinez shut down, to be re-evaluated March 5
Cardinals pitcher Carlos Martinez, who had an MRI this week that showed his right shoulder is structurally sound, will be shut down for two weeks and be re-evaluated March 5.
Machado deal accelerates Padres' path back to the postseason
A team spending to win? The third baseman's move to San Diego changes the prospect-packed Friars' timetable for a return to contention.
Why Manny Machado's record deal makes sense
By signing the biggest free-agent deal in sports history, both the player and the Padres knew exactly what they were doing.