MILWAUKEE (AP) -- Wes Helms was hoping for a line drive to the outfield. He'll take his grounder to shortstop.
With one out and the infield playing for a play at the plate, Helms hit a ground ball to shortstop J.J. Hardy. Ramirez beat Hardy's one-hop throw to the plate to make it 1-0.
"I wanted a ball to drive to the outfield, of course," said Helms, who singled home the winning run Saturday against Washington. "It was a perfect slider for me to drive to the outfield. But it turned out good. I didn't want to do what I did, but I hit it in the right spot."
Added Florida manager Fredi Gonzalez: "In the box score, it's a game-winning RBI. It doesn't matter."
Mota walked Ramirez, gave up a one-out single to Jeremy Hermida and walked Jorge Cantu. Kevin Gregg (3-0) pitched the final two innings and gave up two hits for Florida, which won for the first time since July 5 at San Diego when scoring three runs or less.
"Normally you wouldn't do that with a closer, you know, but he hadn't pitched in four days," Gonzalez said.
The Brewers have scored just one run in the past two games and have been held scoreless over the last 15 innings. They were shut out for the first time since Sept. 10, at Pittsburgh, despite having the lead-off batter reach base eight times.
"It's not an ideal game plan, but it worked," Florida starter Scott Olsen said. He allowed just four hits but walked five -- one intentionally -- in 7 1/2 innings. The left-hander had won his last three starts.
"We're swinging the bats fine," Milwaukee manager Ned Yost said. "You take your hat off to Olsen. "I didn't see one mistake. Not one ball where I said, oh man, we should have crushed that ball."
Milwaukee's Yovani Gallardo, who made his season debut Sunday at Cincinnati after being on the disabled list because of a torn meniscus in his left knee, got his second no decision. The right-hander allowed six hits in seven innings to go with five strikeouts and two walks.
Gallardo got Florida to strand runners in scoring position three consecutive times, including the fifth with the bases loaded.
Luis Gonzalez led off with a single but was caught trying to steal second base. Rabelo followed with another single, and Alfredo Amezaga reached on a fielding error by first baseman Prince Fielder. Olsen struck out when his bunt with two strikes went foul. Hanley Ramirez then singled to right field but third-base coach Bo Porter held Rabelo at third before Dan Uggla grounded out to third.
The Marlins also had runners at first and second and no outs in the seventh but Gallardo retired the next three batters.
"One through nine, they're pretty good hitters," Gallardo said. "I was able to make pitches when I needed them."
Milwaukee had the bases loaded as well but failed to score in the sixth.
Jason Kendall led off with a single and was on second with two outs when Florida intentionally walked Ryan Braun to face Fielder. He also drew a walk, but Corey Hart hit a grounder to third baseman Cantu, who stepped on third for the final out.
Milwaukee played extra innings for the fifth time in nine games. The Brewers are 5-2 overall and Florida improved to 2-0 in extra innings. ... Olsen was hoping to match a career-high by winning his fourth start in a row. He has allowed 16 hits and four earned runs in his last four starts. ... Florida had stolen 11 bases in a row until Gonzalez was caught in the fifth. ... Milwaukee's last 10 games have been decided by three runs or less.