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.
Bryce, Manny, Corbin and more? What a Yankees spending spree could bring
The Bronx hasn't been home to a World Series champion for almost an entire decade. We offer up five offseason moves that would fix that -- if the Steinbrenners are willing to spend like The Boss.
Which teams should shift gears and become buyers or sellers?
The Diamondbacks have been contenders, but they're among the clubs who might want to shake things up by shopping stars like Paul Goldschmidt.
How the Phillies can be smart spending stupid amounts of money
The Phillies have plenty of payroll space and expectations of contention to deliver on. Here's a plan for which top free agents they should target.
Buster's Buzz: A checkup on the state of baseball
A new TV deal and strong attendance don't jibe with complaints about the changing game. What are the strongest indicators of the sport's health?
Astros acquire Aledmys Diaz in trade with Blue Jays
The Astros, who could lose Marwin Gonzalez to free agency, acquired infielder Aledmys Diaz, who hit a career-high 18 homers last season, in a trade with the Blue Jays.
Dodgers closer Kenley Jansen set for Nov. 26 heart surgery
Dodgers closer Kenley Jansen is expected to be ready for spring training after surgery to correct his irregular heartbeat. The surgery, which had been expected, has been scheduled for Nov. 26, with recovery time anywhere from two weeks to eight weeks.