With their backs against the wall in Thursday’s series finale against St. Louis, Colorado let loose with the lumber.

The Rockies scored five runs with two outs in the eighth inning, propelling them to a 10-8 comeback victory at Coors Field. The retiring Charlie Blackmon was central in the rally, with a two-run homer, three runs scored and three RBIs.

“Only four outs left, but you watch enough games to think anything can happen, and this was an instance today where it did,” Rockies manager Bud Black said. “We had a lot of good at-bats. … We didn’t quit, and we had a lot of late life there.”

It appeared the Cardinals were on their way to a sweep after Sam Hilliard and Hunter Goodman both struck out swinging to begin the eighth with Colorado down 8-5. But then the Rockies found a groove en route to hitting through the lineup.

Jake Cave tripled. Aaron Schunk singled. Blackmon walked. Ezequiel Tovar hit his NL-leading 45th double to tie the game, and Ryan McMahon and Michael Toglia followed with doubles of their own to give Colorado its first lead of the day.

“This time of year, late in day games, it’s almost impossible to see in the box,” Charlie Blackmon noted. “The shadows are bad, and the batter’s eye has shadows and contrasts in it. To have the biggest at-bats of the game be in the toughest situation was really impressive for our guys.”

All that made up for Kyle Freeland, in his 200th career start with the Rockies, struggling from the get-go.

The Cardinals bum-rushed the southpaw for a pair of solo homers in the opening frame. Lars Nootbaar drilled a center-cut fastball into the right-field seats. Then the next batter, Paul Goldschmidt, hammered an elevated changeup 457 feet to center field. Those two swings left Freeland shaking his head on the mound.

“You want to end on a high note, and obviously this isn’t the season any of us wanted,” Freeland said. “Today was one of those days where nothing was going for me. I left a lot of stuff over the middle of the plate. They capitalized on it. Every time our offense answered back, I gave momentum right back to the Cardinals.”

Colorado got the runs back in the bottom of the first inning, thanks to some sketchy St. Louis defense. Thomas Saggese booted Blackmon’s grounder to start the frame, then a few batters later, Jordan Walker misplayed Toglia’s liner to right field allowing Blackmon to score. A Nolan Jones double followed to plate McMahon and tie the game.

In the second inning, it was the Rockies’ turn for a defensive letdown.

Jones committed two errors in the inning on a pair of misplays in left field that went off his glove. That, along with a Nootbaar double, gave the Cardinals a 5-2 lead.

But Blackmon, who can soon focus full-time on fatherhood and fly fishing, got the Rockies back into the game. In the bottom of the second, the DH launched a two-run homer 393 feet to right field off Kyle Gibson that just cleared the out-of-town scoreboard. That gave Blackmon 800 career RBIs as well as 227 career homers, pulling him into a tie with Carlos Gonzalez for fifth in dingers in club history.

“That’s cool,” Blackmon deadpanned. “I get to call CarGo now. Cool.”

Blackmon’s sacrifice fly in the fourth scored Jake Cave and tied the game 5-5.

Freeland, however, gave the lead right back the next inning when Ivan Herrera homered 446 feet to center on another hanging changeup. After walking the next batter, Freeland’s day was done.

The southpaw finished the season with a 5.08 ERA, but his ERA was 3.78 after being reinstated on June 23 from an elbow strain that landed him on the 60-day injured list. His return from injury featured a five-game quality start streak across June and July, with a 1.95 ERA in that span.

“I’m happy with how I came off the IL and the rest of the season I had,” Freeland said. “I had a few hiccups in there, but overall I’m happy with what I was able to accomplish with pitch mix, being healthy and getting deep into games for the team.”