Chavis' solo homer, his seventh this season, made it 7-all after the Cubs scored five times in the top of the eighth.
"Those are those moments you kind of dream of," Chavis said of the homer. "It's funny. There have been so many moments where I've been preparing to go up to bat, or up at bat, and you think about trying to create that. Of course, in this opportunity, I didn't try to hit a home run. ... The one time when you're not trying to do it, it does show up that way."
In the 10th, Chavis charged a slow grounder by Jason Heyward toward first base and threw out Patrick Wisdom at the plate. The call stood after a Chicago challenge.
In the bottom half, Chavis blooped a single to right off Scott Effross (1-3) and automatic runner Ke'Bryan Hayes scored in a collision with catcher Willson Contreras. Hayes remained down for a few moments after sliding in, with his left shoulder crashing into Contreras' leg, before walking off under his own power.
Pirates manager Derek Shelton said Hayes seemed fine, but would continue to be evaluated.
"Everything's all butterflies until you see (Hayes) slide in," Chavis said. "Immediately, the way he slid in, I think it was with (Contreras') knee or the shin guard, something like that. Immediately, you're just like, 'I hope he's OK.' ... I've had a couple of walk-offs in my career. I'm not sure if I've ever had an awkward walk-off."
Hayes homered earlier in the game.
"The good thing is he walked off under his own power," Shelton said. "I think it went from a walk-off enthusiasm to about as hushed of a crowd as you can get for a walk-off. When you have a guy like (Hayes), that slides in and stays down for a second ... the concern, at that point, was just making sure he was OK."
Chris Stratton (4-3) pitched the 10th.
Alfonso Rivas capped Chicago's big eighth with a pinch-hit, two-run single up the middle that put the Cubs ahead 7-6. Wisdom had an RBI single and Nico Hoerner hit a grounder that deflected off shortstop Oneil Cruz for a two-run single.
Cruz, on the verge of a third straight strikeout with an 0-2 count, hit an RBI double in the sixth and later scored for a 6-2 lead. The 23-year-old has seven RBI in four games since being recalled from Triple-A Indianapolis on Monday, and at least one RBI in each of his six games in the majors.
Pirates starter José Quintana allowed two runs on six hits with six strikeouts in six innings.
"It was huge," Quintana said. "I felt really good. I want to be back and starting like this one. I felt, today, more economical in my pitches. Quick outs. Get to the sixth inning, throw the ball better."
Justin Steele gave up six runs and seven hits with eight strikeouts in 5 2/3 innings for the Cubs.
Bryan Reynolds put the Pirates ahead 1-0 in the first with his team-leading 12th home run.
Earlier in the inning, there was a six-minute delay after Cubs bullpen coach Chris Young became lightheaded. Chicago manager David Ross went from the dugout to speak with plate umpire Cory Blaser, halting play as trainers ran to check on Young.
Young was taken to a hospital and is expected to be fine, Ross said.
Hayes hit his third homer of the season, a two-run shot that put gave Pittsburgh a 3-2 lead in the bottom half before reaching twice more on errors in the fifth and seventh and sliding in for the game-winner in the 10th.
"If I'm voting, I'm going to vote that he does not slide head-first into the plate," Shelton said.
Cubs: RHP Ethan Roberts, who had been on a rehab assignment for right shoulder inflammation, will require Tommy John surgery. A date for the procedure has not been determined. ... LHP Daniel Norris was placed on the 15-day injured list with left index finger strain. RHP Adrian Sampson was recalled from Triple-A Iowa in a corresponding move.
Cubs: RHP Kyle Hendricks (2-6, 5.43) will start as Chicago heads to St. Louis on Friday for the first of a three-game series against the Cardinals. He gave up six runs in 4 1/3 innings his last outing, a 6-0 loss to the Atlanta Braves on Sunday.
Pirates: RHP Mitch Keller (2-5, 4.72) will take the mound for the start of a three-game set on the road against the Tampa Bay Rays on Friday. Keller has allowed seven runs (six earned) in 22 1/3 innings his past four starts.
Suwinski takes away a HR, but can't hang on for catch-of-the-year candidate
Jack Suwinski leaps up and denies Nico Hoerner a home run, but Suwinski loses the ball going into the wall, resulting in a double for Hoerner.