Despite an NL-high payroll of $214 million-plus on opening day, the Dodgers got off to a 30-42 start and were last in the division, 9 1/2 games behind the first-place Diamondbacks, before play on June 22. Los Angeles has gone 58-23 since.
The Dodgers trailed 6-3 in the sixth and A.J. Ellis hit a tiebreaking homer off Josh Collmenter (4-4) leading off the eighth.
J.P. Howell (2-1) got two outs for the victory.
Ramirez, who sat out five of the last six games with an irritated nerve in his lower back, hit a three-run homer in the third inning and a tying solo shot in the seventh. It was his 13th career multihomer game and first since Aug. 18 of last year.
The Dodgers had lost nine of 12 and five of six entering Thursday.
PIRATES 10, PADRES 1
PITTSBURGH (AP) — Neil Walker had four hits, including his 11th homer, and drove in three runs to Pittsburgh in stopping a three-game losing streak.
Pedro Alvarez hit his NL-leading 34th homer for Pittsburgh. Jose Tabata added two hits and three RBIs as the Pirates moved a game in front of Cincinnati for the top wild card spot in the NL. The rivals begin a three-game series in Pittsburgh on Friday.
Pittsburgh moved within one game of first-place St. Louis in the NL Central.
Gerrit Cole (9-7) struck out a career-high 12 while allowing one run and four hits in six innings.
Pittsburgh scored four runs total while losing three straight games to the Padres but scored five in the fourth against Ian Kennedy (6-10). Alvarez homered to centre with one out to give Pittsburgh the lead.
NATIONALS 3, MARLINS 2
WASHINGTON (AP) — Bryce Harper hit a three-run homer to back an effective pitching performance by Gio Gonzalez, and Washington kept alive their slim hope of reaching the playoffs.
Despite winning 11 of 13 in a belated run, the Nationals trail Cincinnati by five games for the final NL wild-card slot with nine games remaining.
Denard Span went 0 for 4 for Washington, ending his hitting streak at 29 games — one short of the Nationals record. He was bidding to become the 27th player to have a 30-game hitting streak since Joe DiMaggio had his 56-game run in 1941.
Gonzalez (11-7) allowed two runs and seven hits over six innings to improve to 3-0 against Miami this season. He struck out three, lifting his team-high total to 186.
Rafael Soriano got three outs for his 42nd save.
Harper's 20th homer of the season came in the first inning off Henderson Alvarez (4-5).
Ed Lucas had three hits for the Marlins, who must go 7-2 in their last nine games to avoid 100 losses.
ROCKIES 7, CARDINALS 6, 15 innings
DENVER (AP) — Corey Dickerson's RBI triple with one out in the bottom of the 15th inning gave Colorado the win.
Charlie Blackmon finished with four hits and Troy Tulowitzki and Todd Helton homered for the Rockies in tying the second-longest game in Coors Field history.
Matt Holliday had three hits for the Cardinals, who had their NL Central Division lead over Pittsburgh trimmed to one game. The Pirates beat San Diego 10-1 on Thursday.
DJ LeMahieu started the winning rally with a one-out single to right. Dickerson then drilled a line drive into the right-field corner. The relay from second baseman Matt Carpenter beat LeMahieu but catcher Yadier Molina couldn't control the ball as LeMahieu crawled to touch home.
It was Dickerson's second triple of the game and sixth of the season.
In the first inning, Helton tagged out Carpenter at first with the hidden-ball trick. After Roy Oswalt threw to first, Helton feigned a throw back to the mound and tagged Carpenter when he stepped off the bag to end the inning.
The Cardinals loaded the bases in the 15th but Pete Kozma hit into a double play to end the inning.
GIANTS 2, METS 1
NEW YORK (AP) — San Francisco's Madison Bumgarner struck out 10 in seven innings of four-hit ball to outpitch Jonathon Niese.
Juan Perez went 3 for 3 with an RBI and the World Series champions won for the eighth time in 11 games. After taking two of three from the Mets, the Giants don't even have to change hotels — they stay in New York this weekend to play three interleague games at Yankee Stadium.
Bumgarner (13-9) has gone 19 straight starts without yielding more than three earned runs, the longest streak by a San Francisco pitcher since Tim Lincecum's 19 in a row from 2007-08. The previous Giants hurler to do it during one season was Ed Whitson in 1980, according to STATS.
Niese (7-8) threw seven solid innings for the Mets, who rallied for four runs in the ninth to win 5-4 on Wednesday night. They finished 4-7 on their penultimate homestand.
CUBS 5, BREWERS 1
MILWAUKEE (AP) — Luis Valbuena, Nate Schierholtz and Brian Bogusevic homered, and Chicago stopped a five-game losing streak.
Jake Arrieta (3-2) didn't allow a hit until two outs in the fourth when former-Cub Aramis Ramirez singled between second and third. Carlos Gomez hit a solo homer in the seventh.
Arrieta allowed three hits, struck out five, walked one and drove in a run.
Valbuena stopped an 0-for-14 slide with his 12th homer, a solo shot off Kyle Lohse (10-10) in the first. Schierholtz hit a two-run homer in third and Bogusevic added a pinch- homer off Donovan Hand leading off the ninth.
Lohse gave up three runs and seven hits in five innings.Suggest a correction