SAN FRANCISCO (AP/CBS13) — An all-time season for the San Francisco Giants has come to an end.

Cody Bellinger hit a tiebreaking single in the ninth inning and prized midseason acquisition Max Scherzer came out of the bullpen for his first career save, sending the Los Angeles Dodgers past the Giants 2-1 in a thrilling winner-take-all Game 5 on Thursday night and into the NL Championship Series.

READ MORE: New Law Makes Getting License Easier For Barbers And Hairstylists In California

Bellinger’s big hit decided a scintillating NL Division Series between talent-laden teams with lofty win totals — the latest exciting chapter of this storied rivalry.

And the dramatic finish came with a controversial call: With a runner on, Scherzer struck out Wilmer Flores on a check-swing to end it. First base umpire Gabe Morales rang up Flores on appeal — but on television replays, it certainly didn’t appear he swung.

It was a controversial finish to this winner-takes-all game in this rivalry for the ages.

“I don’t think it was a good call and it was a tough angle,” a Giants fan told CBS13 after the game.

No matter, the Dodgers rushed out of their dugout to celebrate on the Giants’ home field. Meanwhile, fans threw beer cans and debris onto the diamond in disgust.

“The umpire said it was a swing, so it was a swing,” Bellinger said.

Mookie Betts had a postseason career-high four hits and will lead the next step for the defending World Series champions at Atlanta for Game 1 of the best-of-seven NLCS on Saturday night.

Los Angeles came back from a 3-1 series deficit to beat the Braves in last year’s NLCS, taking Game 7 by a 4-3 score on the way to its first title since 1988.

“It’s going to be another good one. It’s not going to be easy,” Bellinger said. “We played each other a few times the last few years. So we kind of know what each other’s got, and really looking forward to it.”

Camilo Doval plunked Justin Turner with one out in the ninth and Gavin Lux then singled before Bellinger delivered his most meaningful hit in a scrutinized season.

“You really do want to be in that moment,” Bellinger said.

READ MORE: Dinosaur Exhibits Open At Sacramento Zoo

Scherzer, the Game 3 loser who came over from Washington at the trade deadline, closed out a best-of-five series certain to go down among the several classics these franchises have played — right up there with the 1951 and ’62 clubs that each matched up in three-game tiebreakers for the NL pennant that the Giants won each time.

In the 24th and final meeting between these so evenly matched rivals who knew everything about each other by this stage, it was only fitting they split at 12 apiece. The 107-win Giants edged the Dodgers for the NL West title on the final day, Los Angeles winding up a game back with 106 victories.

“If you would’ve told me we’d win 107 games at the beginning of the season, I would’ve bet money against you,” another Giants fan told CBS13 Thursday afternoon. “Just the fact that we even have that is amazing.”

The Dodgers already won once facing elimination, topping the Cardinals last week in the wild-card game 3-1. And manager Dave Roberts’ bold Game 5 gamble paid off: 20-game winner Julio Urías pitched out of the bullpen instead of starting as originally planned. Urías entered in the third inning and gave LA four innings of relief with five strikeouts.

“I think that you can’t do a job for fear of failure or potential criticism,” Roberts explained. “I think that you have to do your job given whatever you feel is the best way to win the game.”

Betts had the Dodgers’ initial three hits with singles at the top of the lineup before Corey Seager’s RBI double in the sixth as the Dodgers finally got to Game 1 winner Logan Webb.

Then Darin Ruf’s first hit of the series for San Francisco after starting 0 for 9 was a tying home run in the bottom half. The 452-foot drive is the longest of this postseason.

Webb was done after seven more brilliant innings, allowing one run on four hits, striking out seven and walking one as he once more delighted a sellout crowd of 42,275 with their swirling orange rally towels and those deafening “Beat LA!” chants.

The 24-year-old right-hander and two relievers shut out the Dodgers 4-0 here last Friday, and Webb’s Sierra Elementary School to the north in Rocklin held a day in his honor earlier this week.

Betts led off the game with a single but the Giants got out of it with an inning-ending double play and Webb faced the minimum through two.

Right-hander Corey Knebel opened for the Dodgers and gave up Buster Posey’s two-out double in the first, then pumped his fist striking out Brandon Crawford in a seven-pitch at-bat.

MORE NEWS: Homeless Encampments Cause Concern For Local Businesses As Sacramento Shelters Reach Capacity

“Sometimes there’s things that you can’t really explain. It’s kind of like that `It’ thing. I feel like we have it,” Betts said.