Patrick Wisdom hit his 23rd homer for the Cubs, who had only four hits.
Down 3-1, the Cubs scored three in the eighth without a hit against Marlins relievers Steven Okert and Dylan Floro.
''A lot of good things in that inning and then really good pitching,'' Cubs manager David Ross said.
Okert (5-5) walked Zach McKinstry and Christopher Morel to start the inning. Okert then muffed Esteban Quiroz's sacrifice bunt and threw errantly to first. McKinstry scored from second on the error while Morel and Quiroz advanced two bases.
Chicago tied it after Morel beat shortstop Miguel Rojas' throw to the plate on a grounder by David Bote, with Quiroz advancing to third. Happ followed with a fly ball to left off Floro.
Keegan Thompson (10-5) pitched three scoreless innings of relief. Activated from the injured list earlier Wednesday, Thompson allowed one hit and struck out six.
''First batter I was too quick but I settled in, slowed down and got into a rhythm,'' said Thompson, who had been sidelined since Aug. 19 because of low back tightness. ''The adrenaline was going. It felt good.''
Thompson began the season as a reliever before joining the Cubs rotation. He relished his return role in a key spot to keep Chicago close.
''It was nice to come out there and show the confidence to go out and finish it,'' Thompson said.
For the second consecutive night, Okert got the loss after being unable to hold a lead in the eighth. It was the Marlins' 37th one-run loss, matching the club record set in 1993.
''I wanted to go back to him today,'' Marlins manager Don Mattingly said. ''The guy's been good for you. He had a tough (Tuesday) night and wanted to give him a chance for him to respond.''
Marlins starter Jesus Luzardo struck out 11 in 6 2/3 innings of one-run ball. The left-hander allowed three hits and walked one. Wisdom's blast in the seventh ended Luzardo's outing.
''Going into the game, I wanted to establish my fastball,'' Luzardo said. ''What my stuff does is it gets outs in the zone. I have to throw pitches in the right spot, obviously, but just loading it up and letting guys swing out of innings instead of me trying to be too perfect.''
Rookie Nick Fortes and Lewin Diaz homered against Cubs starter Marcus Stroman in the fifth. Fortes' two-run drive cleared the right-field wall and Diaz followed with his solo shot to right.
Stroman, who limited the Marlins to two singles through the first four innings, was lifted after six innings. He allowed three runs and five hits, walked one and struck out seven.
''I felt great, ran into two bad pitches and they made some damage,'' Stroman said. ''That's how baseball is sometimes.''
BASEBALL CLASSIC CALLINGS
Israel has added Marlins relievers Richard Bleier and Jake Fishman to its roster for the 2023 World Baseball Classic next spring. The 35-year-old Bleier also represented Israel in the 2013 tournament's qualifying round.
The Cubs optioned RHP Jeremiah Estrada to Triple-A Iowa for Thompson's spot on the roster.
Cubs: INF Nico Hoerner (triceps) sat out his ninth straight game. ... LHP Steven Brault (left shoulder strain) gave up four runs and four hits and didn't record an out in a rehab appearance with Iowa Tuesday.
Marlins: RHP Edward Cabrera (right middle finger blister) continues to receive treatment and remains in line to make his next start Sunday.
Cubs: RHP Hayden Wesneski (1-1, 2.30) will start the opener of a four-game road set against Pittsburgh on Thursday.
Marlins: Have not announced a starter for the opener of their three-game home series against Washington on Friday.
More AP MLB: https://apnews.com/hub/mlb and https://twitter.com/AP-Sports
Copyright 2023 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.