Heyward was 0 for 5, dropping his average to .170, but threw out Matt Holliday at the plate to end the fourth.
"I got a couple good knocks, my first game-winning RBI," Hammel said. "Honestly, I don't think I wouldn't have been out there without Jason's great play."
Hammel, a career .136 hitter, is 2 for 6 with a double to go with a 1.00 ERA this season. The hits aren't exactly coming from extra work in the cage.
"No, no," Hammel said with a chuckle. "We hit every day but I'm not trying anything different. I've just been trying to get the barrel out."
Heyward, who left the Cardinals for Chicago as a free agent, weathered more boos in his second game in St. Louis, but again didn't seem to mind.
"The boos got louder after I threw out Holliday at home, but whatever, it doesn't matter," Heyward said. "The fans are always going to do what they want to do regardless, and wherever you're playing you've just got to try to help your team win."
The Cardinals stranded two runners against the Cubs bullpen in the seventh and eighth. Yadier Molina was at second base when Hector Rondon struck out pinch-hitter Jedd Gyorko to earn his third save in three chances.
Chicago leads the majors at 11-3 and goes for a three-game sweep Wednesday over the defending NL Central champions. They last swept St. Louis in three games on the road Sept. 13-15, 2010.
Cubs starters have worked at least six innings the first 14 games of the season. That's the most in the majors since 1988, when the Astros went 22 games and the Indians 17, according to STATS.
Hammel (2-0) allowed a run on five hits with six strikeouts and no walks. The right-hander also gave Cubs pitchers three RBI in two games and the lead with a two-run, bases-loaded single in the fourth.
Jaime Garcia (1-1) had thrown 15 2/3 consecutive scoreless innings before Hammel's hit. The lefty struck out seven but was hindered by four walks and lasted five innings after throwing a one-hitter his previous outing.
"It's not what I want to do," Garcia said. "Way too short and I've got to do a better job than that next time."
Molina had an RBI triple in the second, but the Cardinals missed a chance for more because Matt Adams strayed off second and was picked off. The Cardinals had runners on second and third with none out in the fourth but came up empty when Heyward made a perfect throw to nail Holliday trying to score on Molina's flyout to right.
Heyward is 0 for 9 in the series.
"I've had some good plays made against me and some at-em balls but it's not about that," Heyward said. "What's impressive about our team is we don't have everyone hitting right now and we're still finding ways to win."
St. Louis is 0 for 14 with runners in scoring position the first two games of the series.
"Against a club like that, you've got to get runs across," Adams said. "Everybody was going up there having good at-bats and their pitchers just made good pitches."
Cubs: Kyle Schwarber, out for the season with a left knee injury, underwent surgery to repair two ligaments.
Kyle Hendricks (1-1, 2.84) lost his last start, allowing two earned runs in six innings against Colorado. Carlos Martinez (2-0, 3.46) is 6-2 with a 2.97 ERA in 12 career day starts. He's 2-0 against the Cubs as a starter, but with a 5.48 ERA.
Did MLB get it right with a 1-game suspension for Donaldson?
Doug Glanville comments on MLB's decision to suspend Josh Donaldson for one game for "inappropriate comments" made to Tim Anderson.
Fantasy baseball forecaster: Team hitting ratings
Stay ahead of the game and optimize your fantasy baseball hitters with our forecaster, which provides a rolling 10-day outlook of every team's hitting matchups as well as the potential for stolen bases.
Fantasy baseball forecaster: Pitcher projections for the next 10 days
Keep up to date on who is pitching -- and how well they're expected to do -- with our forecaster, which provides a rolling 10-day outlook of every team's probable starting pitchers with game score projections.
Who in MLB is must-see TV right now? This season's most watchable teams and players
From star-studded rosters to five-tool sluggers and nasty aces, here's who is bringing the most excitement to baseball.
Who are the must-see players in baseball?
Kevin Connors and Tim Kurkijan discuss which of the plethora of young players in baseball are the most fun to watch.
Fantasy baseball pitcher rankings, lineup advice for Tuesday's MLB games
Everything you need to know to place your MLB bets and set your fantasy baseball lineups for Tuesday, May 24.