ATLANTA (AP) Marlins manager Don Mattingly nearly sent Jose Fernandez back to the hotel early so he could get extra rest for his start on Saturday.
Instead, the Miami ace stuck around for some theatrics with his bat.
Making the first pinch-hit appearance of his career, Fernandez drove in the go-ahead run with a two-run double in the 12th inning, helping the Marlins beat the Atlanta Braves 7-5 on Friday night.
''That's always been like a dream, play the outfield or get to pinch hit like that,'' Fernandez said. ''When it actually happened, it was like, `Oh my God, we're really doing this.' My heart rate started, (but) the main goal was just try to hit a ground ball somewhere and get a run and go home.''
The dramatic moment overshadowed the meltdown of closer A.J. Ramos, who blew a rare save in the ninth for Miami. Ramos had converted 33 straight saves, one short of the franchise record, before Tyler Flowers led off with his sixth homer to force a 5-5 tie.
''He battled back after that,'' Mattingly said. ''He's always that guy you know isn't going to panic. You could tell it didn't rattle him. He stayed in control and ended up getting us out of that jam.''
Fernandez, one of baseball's most dynamic starters, began the game with a .222 batting average in 27 at-bats. With the pitcher's spot due up in the 12th and no position players available, Fernandez batted for reliever Nick Wittgren (3-1) and delivered the big hit.
''The game was going at a real fast pace,'' Fernandez said. ''I said, `I'm going stay and watch the game with the guys and be with them. I may put my cleats on just in case. It's a long shot.' Warmed up for like 20 minutes. `I'm not going to hit anyway, but I'm still going to warm up.' "
Before the game, Mattingly said that Ramos would remain the closer after the team traded for Fernando Rodney. Rodney did his job, facing four batters in a scoreless eighth, but Ramos wasn't as lucky.
Rodney, whose 253 career saves rank fifth on the active list, converted all 17 of his chances this year for the Padres, but Mattingly said the plan was for him to work primarily as a setup man with Miami.
The Marlins snapped a three-game skid and improved to 3-7 against Atlanta, the NL's worst team.
Casey Kelly (0-3), the sixth Atlanta pitcher, took the loss.
Marcell Ozuna went 4 for 6, homered and drove in three runs for Miami. Martin Prado, Christian Yelich and Ozuna each had a two-out hit in the seventh when Miami scored twice to take a 5-4 lead.
Braves ace Julio Teheran began the night having pitched 23 consecutive scoreless innings, but his career-best streak ended quickly when Miami took a 3-0 lead in the first on Derek Dietrich's leadoff homer and Ozuna's 17th homer, a two-run shot.
Teheran avoided trouble in the second when he struck out Yelich to strand the bases loaded, but Yelich chased him in the seventh with an RBI single that made it 3-all.
Teheran allowed 11 hits and five runs and struck out six in 6 2/3 innings. His ERA rose .26 points to 2.72.
Atlanta cut the lead to 3-2 in the second on Erick Aybar's RBI single and Teheran's groundout.
Ozuna's RBI single in the seventh came off Chris Withrow for the go-ahead run.
In his previous 12 starts, Teheran was just 3-5 despite a 1.61 ERA and a .160 opponents' batting average.
''It was a battle,'' Teheran said. ''It was kind of a different game. You're not going to feel the same way every game. You try to, but sometimes it's not going to happen.''
Marlins starter Justin Nicolino gave up seven hits, four runs, one walk and struck out one in five innings. The left-hander blew a 3-0 lead when Chase d'Arnaud hit his first career homer, a two-run shot, to put the Braves up 4-0 in the fifth.
Recalled before the game from Triple-A New Orleans, Nicolino has an 8.22 ERA over his last three starts.
Dietrich was hit by a pitch in the second, marking the third time this series and 16th this season, most in the majors. Even the visiting dugout at Turner Field hasn't been a safe place Dietrich, who was hit in the head by Yelich's foul liner on May 29. Carlos Delgado set the Marlins' single-season record after getting hit by 17 pitches in 2005.
Atlanta CF Ender Inciarte strained his right groin and had to leave the game in the sixth inning.
LHP Jo-Jo Reyes was designated for assignment with Rodney's arrival. The Marlins optioned RHP Brian Ellington to New Orleans to make room for Nicolino.
Marlins: RHP Fernandez (10-3) has a 2.15 ERA and a 4-1 in seven career starts against Atlanta.
Braves: RHP Lucas Harrell (0-0) will make his first start since 2014 with Houston. He went 2-1 with a 2.81 ERA in nine appearances at Triple-A Gwinnett.