Follow CBSMIAMI.COM: Facebook | Twitter

ST. LOUIS (The Sports Xchange) — Call it a case of failure ultimately leading to success.

READ MORE: Seminoles Suspend Sports Betting After Court Rulings

Miami Marlins second baseman Miguel Rojas atoned for a flyout that left the bases loaded in the seventh inning Friday night with a tie-breaking RBI single in the top of the ninth, giving Miami a 7-6 win over the St. Louis Cardinals in a battle of National League wild-card hopefuls.

Rojas grounded a 2-2 pitch from closer Seung Hwan Oh (2-1) past diving third baseman Jhonny Peralta, scoring Marcell Ozuna from second as the Marlins (48-41) stayed in a tie with the New York Mets for the second wild-card spot.

Rojas said he learned from his missed opportunity in the seventh.

“I got down a little bit, but the next situation, I was a little more calm,” he said. “The first situation got me ready for the second one. I tried to put a good swing on the ball and fortunately, it found a hole.”

Rojas’ hit made a winner of reliever Fernando Rodney (1-2), who worked a clean eighth. Closer A.J. Ramos earned his 28th save despite allowing singles to Tommy Pham and Aledmys Diaz, fanning Matt Adams with the potential winning runs aboard.

Miami survived allowing four homers and trailing 4-1 after five innings.

“That was a wild one there,” Marlins manager Don Mattingly said. “It was back-and-forth. They hit us with a four-spot, we kept creeping back and got the lead, and then they hit two more homers. There was a lot of stuff going on.”

Getting contributions up and down its lineup, Miami scored in each of the last four innings, feasting on the St. Louis bullpen and defense to make its comeback.

Chris Johnson’s RBI groundout in the sixth pulled the Marlins within 4-2. They took the lead in the seventh as former closer Trevor Rosenthal struggled again, hitting Giancarlo Stanton with the bases loaded to force in a run and then coughing up a two-run single to Ozuna.

After Pham and Randal Grichuk gave the Cardinals (46-43) a 6-5 edge in their half of the seventh with long solo homers off reliever David Phelps, Miami equalized in the eighth. Martin Prado slapped a two-out RBI single off reliever Jonathan Broxton, scoring Ichiro Suzuki.

Suzuki reached on a pinch-hit single, the 2,991st hit of his major league career, and reached second on a bad pickoff throw by Kevin Siegrist, St. Louis’ MLB-high 69th error this year.

READ MORE: 23rd Annual 'A Home For The Holidays At The Grove' Comes To CBS On Sunday, December 5th

Defense haunted the Cardinals again in the ninth. Ozuna’s one-out liner to center looked catchable, but the ball sailed over Grichuk’s head and short-hopped the wall for a double.

“The ball tilted on me,” Grichuk said.

For St. Louis, which dropped two games behind the Marlins and New York Mets for the second wild card spot, it was one of its most frustrating losses of the year. It dropped to 19-27 at Busch Stadium, where it was 55-26 last season.

“This one stings,” Cardinals manager Mike Matheny said. “Every decision I made didn’t work.”

The Marlins initiated scoring in the fourth on Johnson’s RBI double down the left field line, scoring Ozuna, whose potential 4-6-3 double-play grounder became a fielder’s choice when Matt Holliday couldn’t corral Diaz’s one-hop throw.

But the Cardinals used power to gain control in their half of the inning. Stephen Piscotty cracked his 12th homer to lead off the inning, and Pham lined a three-run blast just inside the left-field foul pole for a three-run advantage.

However, St. Louis couldn’t hang on to the lead, losing for the first time in eight games when belting four or more homers.

“You love coming out after the break and getting a win, but it’s sort of like Opening Day,” Mattingly said. “You have a lot of big games left.”

Miami starter Wei-Yin Chen lasted six innings, giving up six hits and four runs with a walk and three strikeouts. Cardinals lefty Jaime Garcia pitched 6 1/3 innings, allowing eight hits and four runs with two walks and two strikeouts.

The game was delayed about 15 minutes in the bottom of the first when home plate umpire Chad Fairchild was struck by a Holliday foul ball on his right elbow. Fairchild left the game, replaced by crew chief Jim Joyce. There was no official word on the extent of Fairchild’s injury after the game.

NOTES: Miami Friday recalled OF Yefri Perez from Double-A Jacksonville, two days after it optioned C Tomas Telis to Triple-A New Orleans. Perez was leading the Southern League in stolen bases with 39. … St. Louis activated LHP Kevin Siegrist (mononucleosis) from the 15-day DL Friday and optioned RHP Sam Tuivailala to Triple-A Memphis. Siegrist pitched an inning, allowing an unearned run. … The Marlins signed high school LHP Braxton Garrett, their first-round pick in last month’s First-Year Player Draft, Friday to a contract calling for a $4,145,900 signing bonus, well above slot value of $3,756,300.

MORE NEWS: Sharp Increase In Hospitalized Children With Covid Investigated In South Africa

(© Copyright 2016 The Sports Xchange. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)