The Brewers have won five straight, eight of nine and 15 of 19 to climb into the playoff race. They remained 2½ games back of St. Louis for the second NL wild-card slot.
"We're doing everything right, right now," Ramirez said. "I played on a couple of really good teams in Chicago (with the Cubs) but we started off the season really well. We've kind of made a late push here. Hopefully, it's not too late."
Milwaukee had quite the closing push on Thursday. It trailed 7-4 before rallying for four runs in the eighth inning.
Carlos Gomez and Jean Segura opened the inning with consecutive singles off Chad Qualls. Norichika Aoki doubled in a run with one out, and Weeks greeted Chris Resop (1-4) with a triple to the 410-foot mark in left-center.
"I was thinking extra-base hit because not only would that score a run there but it would give Rickie a chance to tie the game up in the next at-bat," Aoki said.
Which is exactly what Weeks did.
"Rickie's hit was huge," Milwaukee manager Ron Roenicke said. "That was a great at-bat, a big hit off a breaking ball."
Ramirez had three hits and three RBIs for Milwaukee, which built an early 4-0 lead. Gomez also had three hits and Aoki extended his hitting streak to 10 games.
"We did so many good things offensively," Roenicke said. "Guys are running well, they're moving runners, they're doing a lot of things to help us. When a team rolls, it's not just one or two guys that are doing it."
The stumbling Pirates (74-75) have dropped three straight and 11 of 13 to slip under .500 for the first time since May 29. They are 5½ games behind the Cardinals and are in danger of a 20th straight losing season, which would extend their major North American professional sports record.
The Pirates were a season-high 16 games over .500 on Aug. 8 at 63-47 but have lost 28-of-39 games since.
"I wish I had an answer for why we're struggling," Barmes said. "Everything was clicking for us for so long and it seemed like we were doing all the little things right to win games. Now it's not clicking and it just seems like nothing is going our way."
Manny Parra (2-3), the fifth of seven Brewers pitchers, tossed a scoreless inning for the win. John Axford got three outs for his 31st save in 39 chances, working around an error by rookie shortstop Segura.
The Pirates scored three runs in the sixth to take a 7-4 lead. Barmes hit his eighth homer, Marte singled in a run and Travis Snider had a sacrifice fly.
Milwaukee got off to a fast start, but Pittsburgh managed to put together a quick response.
Ramirez hit a two-run homer off Wandy Rodriguez in the first, then doubled and scored in the third.
Rodriguez allowed four runs and five hits in four innings. The left-hander was 3-0 with a 1.40 ERA in his previous four starts.
Fiers gave up three runs and five hits in three innings. The rookie is 3-4 with a 6.75 ERA in his last eight starts after going 6-4 with a 1.82 ERA in his first 12.
"When we pitch, we usually win ballgames," Ramirez said. "Today we didn't pitch and we scored a lot of runs. That's how good teams win ballgames, you've got to pick each other up."
Brewers 1B Corey Hart played for the first time in 10 days: He had been sidelined by a torn plantar fascia in his left foot. He went 1 for 3 and was pulled after five innings to rest. ... Pirates 2B Neil Walker returned to the lineup after sitting out two of the previous three games with lower back soreness. ... Milwaukee opens a four-game series at Washington on Friday night while Pittsburgh begins a three-game series at Houston. RHP Shaun Marcum (5-4, 3.91 ERA) will pitch for the Brewers against Nationals RHP Edwin Jackson (9-10, 3.89 ERA). Pirates LHP Jeff Locke (0-1, 5.49 ERA) will look for his first major league win when he faces Astros RHP Edgar Gonzalez (2-1, 4.40 ERA).
Mets prep for playoffs with 9-2 rout of Nationals
— Francisco Lindor and the New York Mets geared up for the playoffs with a 9-2 rout of the Washington Nationals on Wednesday, completing a fantastic regular season with the second-most wins in franchise history.
Canha opens scoring with a big 3-run HR
Mark Canha gets the Mets on the board first with a big three-run home run to left field.
Minnesota Twins troll Aaron Judge after Luis Arraez wins batting title
With Arraez winning the batting title, New York Yankees slugger Aaron Judge won't win the Triple Crown. The Twins took the opportunity to poke fun at the American League home run king.
Mattingly wins his last game as Marlins manager, tops Braves
— Don Mattingly went out as a winner in his final game as Miami’s manager when rookie Peyton Burdick homered and drove in four runs to lead the Marlins over the NL East champion Atlanta Braves 12-9 on Wednesday.
Christian Vazquez belts 1st HR with Astros
Christian Vazquez's 404-foot home run puts Astros up 3-0.
Stephen Vogt celebrates final game with intro from kids, HR
After being introduced by his kids, Stephen Vogt homers with the Oakland A's in his final MLB career at-bat.