Miami snapped a season-high seven-game losing streak, and salvaged the series finale with Arizona, which won the first two games of the series.
Nolasco was brilliant, striking out 11 while allowing one run in eight-plus innings. Holding on wasn't easy, and it required Steve Cishek and Mike Dunn to get Miami through the ninth.
The unsung hero of the day, manager Mike Redmond pointed out, was Perez.
"Tony Perez came out before the game and touched all the bats," Redmond said. "So I felt good. We got two runs. That was just what we needed."
Nolasco actually provided the biggest boost, performing like an ace as he improved to 3-5. The 11 strikeouts were his most since striking out 11 Nationals on May 6, 2011.
"He's a good pitcher," Arizona's Paul Goldschmidt said. "He located his fastball up, down and in and out, and his slider was really good today. You saw there were a lot of swings and misses on it."
In a season where nothing has been easy, securing the final three outs was a challenge.
Nolasco carried a two-run lead into the ninth, and attempted to lock down his 10th career complete game. But his bid lasted one batter, as Didi Gregorius doubled to open the inning and Nolasco turned the ball over to Steve Cishek after 110 pitches.
"I wanted to finish it, but at the same time, we've got Cishek down there," said Nolasco, whose 79 career wins are more than any Marlins pitcher. "Fourth time around the lineup, and those guys seeing me. It was a good decision to make."
Cishek entered and retired Paul Goldschmidt on a grounder to second. On the play, Derek Dietrich made a terrific stop up the middle. Gregorius advanced to third, and then scored on Jason Kubel's sacrifice fly to left.
Arizona wasn't done threatening. Eric Chavez delivered a pinch-hit single to right. Dietrich made a diving attempt and was shaken up. Redmond and trainer Sean Cunningham came out to check on the 23-year-old rookie.
"I asked him, 'Are you ready to make this diving play to end this game?' " Redmond said. "He said, 'Yes, sir.' That's what I wanted to hear."
The inning was prolonged when Martin Prado walked, and Cishek was lifted for Dunn.
Dunn walked Miguel Montero to load the load the bases. And with the count full to pinch-hitter A.J. Pollock, Dunn was able to induce a ground ball to shortstop that was handled for the final out.
"At that point, we're trying to win the game and trying to mix and match and get that final out," Redmond said.
It was Dunn's second career save and first of the season.
"We decided to stick with the fastball, and make him beat me on my best pitch," Dunn said. "We were just focusing down and away. With the 2-2 pitch, we just missed up and out, and it was just execute. You have to execute the pitch, and we got him to roll it over to shortstop."
Blanked 1-0 on Saturday, the Marlins had a string of 14 consecutive scoreless innings snapped in the sixth inning Sunday.
With two outs, Ozuna crushed a two-run double off the wall in left-center, giving the Marlins their first lead in the series.
Adeiny Hechavarria, leading off against the left-handed Wade Miley, singled with one out. Dietrich's single to right put runners on the corners for Ozuna, who blistered a long drive that nearly had the height to clear the fence.
"The first couple of ABs, I was trying to hit it to right field," Ozuna said.
The rookie right fielder was urged by hitting coach Tino Martinez to try to turn and drive the ball to left. He did as instructed.
"Tino kept telling me, 'Hit it that way! Hit it that way! Pull it!' Ozuna said. "I was thinking, 'Stay back and swing at the inside pitch,' sometimes like I do in BP."
The way the ball came off the bat, Ozuna was thinking he may have belted a three-run homer. But at spacious Marlins Park, the drive went off the wall.
"I was thinking, 'Home run!' " Ozuna said. "When I finished my swing, I was thinking, 'The ball is not going. I saw the outfielder keep going back.' When I looked at the ball, I saw it was going to hit the fence. But it is OK, a double, I'll take it -- as long as I'm safe."
On May 5 at Philadelphia, Miami celebrated its biggest scoring output of the season, beating the Phillies, 14-2. In the 12-games since, the Marlins have 19 runs, including two on Sunday.
Until the sixth inning, Miley had limited Miami to two baserunners. In the third inning, Jeff Mathis doubled and Chris Coghlan had a double in the fifth.
The Marlins are now 8-5 when they score first, and 6-11 in one-run games.
"Nobody wants to lose," Nolasco said. "We've been playing close games and stuff. It doesn't matter if you lose 10-0 or 2-1, you don't want to lose. It was good to snap that and try to get on a roll here."