CHICAGO -- The Arizona Diamondbacks saved their best for last as they busted out of a dreary slump Wednesday.
Trailing 5-2 heading in the ninth inning, the Diamondbacks took advantage of a Chicago Cubs bullpen collapse to rally to a 7-5 victory on a day marking Wrigley Field's 100th birthday.
The victory snapped a four-game losing streak, part of a run of 10 losses in their last 11 games.
"It was very good, it was a longtime coming," said Diamondbacks manager Kirk Gibson. "We got some breaks ... then (second baseman Aaron) Hill just conveniently placed one inside the (right field) line."
Right-handed reliever Justin Grimm gave up the two-out triple in the ninth to Hill that scored catcher Miguel Montero and third baseman Martin Prado open a 7-5 lead.
"We battled back," Prado said. "I just hope from this point on that good things will start happening with us."
Hill went 4-for-5 with 2 RBIs while right-hander Trevor Cahill (1-4) picked up his first win of the season after working two scoreless innings. Right-hander Pedro Strop (0-2) took the loss in his fifth appearance.
Cubs right-hander Jeff Samardzija, meanwhile, finally had run support but got no decision for the third time this season as the Cubs failed to hold the late lead.
Samardzija allowed just two earned runs, walked two and struck out seven in his third no-decision outing. He shrugged off questions about disappointment.
"As a starting pitcher you know when you're pitching -- every fifth day," he said. "Regardless of the last time out you have a short memory as a pitcher. If you start carrying it over start to start it's when it starts to snowball on you."
Wednesday's game was the 7,883rd game at Wrigley Field since the Chicago Federals hosted the Kansas City Packers in an April 23, 1914, debut at Weeghman Park.
The Cubs moved in two years later and the name was changed to Cubs Park. The Wrigley Field name was adopted in 1927.
As part of centennial festivities the Cubs wore Federals throwback uniforms while the Diamondbacks were clad in Packers attire.
The Diamondbacks claimed a 1-0 lead in the second inning. Montera scored as shortstop Chris Owings grounded into a fielder's choice with one out.
The Cubs used a three-run outburst to claim a fifth inning lead.
Second baseman Darwin Barney brought home third baseman Mike Olt on what started as a sacrifice to first. Barney was safe and reached second on a throwing error by Diamondback's first baseman Paul Goldschmidt that also moved catcher Welington Castillo to third.
Samardzija's sacrifice to right-center drove in Castillo for a 2-1 lead. Center fielder Emilio Bonifacio's fielder's choice tap to Miley brought home Barney to make it 3-1.
The Diamondbacks got one run back in the sixth as left fielder Cody Ross' RBI single scored Goldschmidt from second.
But Ruggiano lined a 372-foot homer to right with none out in the sixth -- his first of the season -- and drove in Anthony Rizzo for a 5-2 lead.
Miley was then replaced by right-hander Brad Ziegler. Miley, who had no decision, lasted five innings and gave up four hits, three earned runs while walking three and striking out seven.
"He threw way too many pitches early and had a lot of three ball counts," Gibson said. "When you get up too close to 100 pitches you have a better chance of making a mistake."
Samardzija worked 7 1/3 innings and departed with runners on first and second, but right-handed reliever Hector Rondon ended the inning without any damage.
Strop walked Owings to open the ninth. A potential double-play grounder by center fielder Tony Campana was bobbled by Cubs shortstop Starlin Castro, leaving runners at first and second with none out.
Strop then walked Eric Chavez to load the bases for leadoff batter Gerardo Parra, representing the lead run.
Parra struck out on a full count but Prado singled up the middle to score Owings and Campana to cut the Cubs lead to 5-4 while A.J. Pollock -- running for Chavez -- reached third.