Arizona starter Ian Kennedy (3-3) allowed four runs on three hits in seven innings and retired 20 of the final 21 batters he faced to help end Chicago's five-game winning streak.
Nate Schierholtz hit a solo shot and an RBI double, but the Chicago bullpen couldn't hold a 3-1 lead for Samardzija, who was relieved after throwing 115 pitches.
With the scored tied at 4 in the eighth inning, Parra hit what looked to be a go-ahead RBI double off Cubs reliever Carlos Marmol (2-3), but the ball got stuck in the ivy in the center field wall, resulting in a ground-rule double. Willie Bloomquist, who was running on the pitch and would've easily scored from first, was sent back to third base.
After a walk to load the bases, Goldschmidt hit a long shot off Marmol's slider to center field for his first career grand slam, giving the Diamondbacks an 8-4 lead.
Goldschmidt struck out in his first three at-bats against Samardzija.
"You can have three bad ABs, I don't even know if that qualifies as bad ABs. Samardzija's stuff was really good, but you get a chance to win the game in the eighth or ninth you can't live in the past," Goldschmidt said. "It's a game of failure. It's what the game is all about."
Diamondbacks manager Kirk Gibson knows the feeling of rebounding after a few bad at-bats.
"You are there, you are striking out, the fans are yelling at you, you're disappointed that you're letting the team down, but it is a great feeling when you come through. It happened to me many times," Gibson said.
The Diamondbacks scored a season-high 12 runs and had a season-high 17 hits.
Trailing 3-1 in the seventh inning, Goldschmidt worked a walk against Samardzija to put runners on first and second and end Samardzija's outing. After retiring the first batter he faced for the second out, Cubs reliever James Russell walked Martin Prado, and Kubel followed with a double to clear the bases and give Arizona a 4-3 lead.
"One thing we did good against him we got his pitch count up. Then we got into their bullpen we got some big hits and won the game," Gibson said.
After retiring 17 straight batters, Kennedy was tagged by Schierholtz for a home run leading off the bottom of the seventh. It was Schierholtz's seventh of season.
"It was probably only the second time I shook off Miggy (Miguel Montero) all game. He called a great game," said Kennedy. "It was one of those things, `Gosh darn it, I should have stayed with it."'
Samardzija showed flashes of his dominant performance against the White Sox on Monday, but was pitching in and out of trouble most of the night. He allowed three runs and seven hits, while striking out 11 and walking three. In his previous outing against the White Sox, he pitched a two-hitter while striking out eight.
The Cubs' bullpen gave an up nine runs and 10 hits with four walks in 2 2-3 innings.
"The bottom line is, you walk eight guys, you're not going to win too many games, no matter what, when you walk eight guys. It basically came down to the walks. Obviously they got a couple big hits to bust the game open. But the walks were the difference in the game," Cubs manager Dale Sveum said.
After a 2-hour, 21-minute rain delay, Parra led off the game with a home run to right. It was the fourth time in his career he led off a game with a home run and it was his fifth of the season.
"They're a fastball-hitting team, they're really aggressive. I knew they were on it, especially after Parra's first at-bat, so I started making better pitches. Used my slider to get ahead in the count and kind of got back on track there. Splitter was good. Just avoid those walks in the seventh," Samardzija said.
With no outs in the first inning, the Cubs loaded the bases. David DeJesus scored on Alfonso Soriano's sacrifice fly then Schierholtz hit an RBI double down the right field line. Anthony Rizzo scored on Welington Castillo's ground out to give the Cubs a 3-1 lead.
Sveum was ejected by home plate umpire Joe West in the second inning after arguing a close call at first base. It was his second ejection of the season.
Kennedy was back on the mound after missing his last start because he cut his right index finger while washing a knife.
- Arizona 3B Eric Chavez is expected to miss two to three weeks after an MRI revealed a minor tear of his right oblique muscle.
- Diamondbacks placed RHP Brandon McCarthy on the disabled list Saturday because of right shoulder inflammation and recalled RHP Randall Delgado from Triple-A Reno.
- In his first game of the season, Bloomquist was 3 for 4. He was activated from the DL on Friday with an oblique injury.