ST. LOUIS -- In the big leagues primarily as a defensive replacement, Cardinals rookie outfielder Lane Thomas pounced with a chance to flex his hitting muscles.
The Cardinals rallied from an 8-4 deficit to sweep the three-game series and move into second place in the NL Central, two games behind the Chicago Cubs.
Thomas, playing his 21st game, drove in five runs. His first career slam came off Kyle Crick (3-7) and put the Cardinals ahead 9-8. He also had an RBI triple in the fourth.
"I knew he was going to throw a fastball and I just tried to get ready for it," Thomas said.
Thomas, who has been recalled from the minors four times this season, started for only the second time. Most of his other 19 appearances came as a late game defensive replacement.
"My main focus is to make sure my body feels good and that I'm ready when the opportunity comes up," Thomas said. "My role has been the defensive part of it, and I really focus on that."
St. Louis manager Mike Shildt was impressed with Thomas' all-around effort. Thomas hosed Adam Frazier at the plate with a one-hop throw from center in the first inning.
"It speaks to the kind of player that he needs to be," Shildt said. "He's going to need to be the guy that can do things like that."
Crick got two strikes on Thomas but could not put him away.
"I was going to throw a heater down," Crick said. "I think it ended up inside about thigh high and he put a pretty good swing on it."
Goldschmidt hit his team-high 26th homer in the first inning and started the five-run seventh-inning rally with a leadoff single. Marcell Ozuna followed with a single, and Crick hit back-to-back batters to set the stage for Thomas' third homer of the season.
Fowler hit a two-run homer in the eighth off Geoff Hartlieb.
"A game that encapsulates this team's toughness," Shildt said. "We have the kind of players that you win with."
Bell hit two-run homers in the first and fifth innings. It was the fifth multihomer game of his career, all this season. The homers, his 28th and 29th, were his first since July 5. He has an NL-leading 68 extra-base hits.
Pittsburgh starter Steven Brault gave up four earned runs on five hits over 4 2/3 innings. He struck out three and walked three. Brault had a seven-game hitting streak halted with an 0-for-2 performance. He came into the contest on an 8-for-10 run.
Cardinals starter Miles Mikolas surrendered five earned runs and seven hits over five innings. He gave up both home runs to Bell.
St. Louis outfielder Jose Martinez left the game in the fifth with right shoulder discomfort. He will undergo tests on Monday and is considered day-to-day.
The Pirates are 20-41 since June 1.
"At the end of the day, the game's designed to break your heart," Pittsburgh manager Clint Hurdle said. "And the game beats you up every once in a while."
The Cardinals will play 24 of their next 30 games against teams with losing records and a combined .446 winning percentage. St. Louis is 31-20 against teams with losing marks.
Pirates: C Francisco Cervelli began a rehab stint Sunday night with Double-A Altoona. Cervelli was placed on the 60-day injured list with a concussion May 26.
Cardinals: C Yadier Molina is, "very likely," to rejoin the team on Tuesday, according to Shildt. Molina has been out since July 8 with a right thumb tendon stain. He has missed the last 28 games.
Pirates: RHP Mitch Keller (0-1, 10.50) will face Los Angeles Angels LHP Jose Suarez (2-3, 6.22) in the first of a three-game set in Anaheim on Monday. Keller will be recalled from Triple-A Indianapolis on Monday. He will be making his fourth major league start.
Cardinals: RHP Jack Flaherty (5-6 3.72) will take on Kansas City RHP Glenn Sparkman (3-7, 5.71) in the first of a two-game series on Tuesday in Kansas City. Flaherty struck out 10 batters in seven innings of a 2-1 loss to the Dodgers on Wednesday.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Untold tales of Cal Ripken Jr., the Iron Man who saved baseball
Cal Ripken Jr. brought baseball back after the strike with his record-breaking run in 1995. Here are some stories of the summer of 2,131 you might not have heard.
Viewers guide: The night Cal Ripken Jr. became baseball's Iron Man
The sport was still stinging from the 1994 strike, but all was forgotten when the Orioles shortstop broke Lou Gehrig's unthinkable record for consecutive games played.
Tim Kurkjian's baseball fix: Adrian Beltre was so confident, he didn't wear a cup
Playing third base in the majors and not wearing a cup seems like a bad idea. But Adrian Beltre, a future Hall of Famer, believed his defense was good enough to save him.
Second-Chance World Series, Round 2: Which clubs advance to our Elite 8?
Are the 1993 Phillies making the most of their second chance? Are the 2001 Mariners unstoppable? The field narrows in our runoff sim of MLB's best non-champs.
Stories to remember Adrian Beltre by on his birthday
Tim Kurkjian celebrates Adrian Beltre's birthday by sharing some of his favorite stories about the third baseman.
Is it safe to start the MLB season in May?
Jeff Passan gives an inside look into the MLB's decision to potentially start the season in May and the health concerns that come with it.