Toronto’s big gambles paid off.

Last summer, after five years of winning at least 48 games and looking impressive in the regular season only to stumble in the playoffs, Toronto’s team president Masai Ujiri went all in. He fired the NBA’s Coach of the Year in Dwane Casey to hire his assistant Nick Nurse with the hope of installing a more creative offense.

Then they traded fan favorite and (at least to that point) the greatest Toronto Raptor in franchise history DeMar DeRozan to get Kawhi Leonard, a guy coming off an injury that essentially sidelined him for a season. A guy who would be a free agent after one season. Leonard could bolt — like other stars had done north of the border — and leave the Raptors high and dry.

It was all a massive roll of the dice.

Toronto hit their number with that roll — the Raptors are headed to the NBA Finals for the first time in franchise history.

Toronto stormed from 15 points down in the third behind another monster game from Leonard — 27 points, 17 rebounds, 7 assists — and held on to win Game 6 in front of a raucous home crowd, 100-94.

Toronto will host Game 1 of the NBA Finals Thursday night against the two-time defending champion Golden State Warriors.

The Raptors may not be familiar with that stage, but Leonard knows both the Finals stage and that opponent (recall that the last time he faced them Zaza Pachulia slid under his foot on a jumper, spraining Leonard’s ankle and ending San Antonio’s playoff hopes that season). Thoughts about July 1 are banished for now in Toronto, the party is on.

“It means a lot,” long-time Raptor Kyle Lowry said about making the Finals. “It’s taken a long time to get here in my career, 13 years, seven years here [in Toronto]….

“But I’m not satisfied.”

This series changed in Game 3 when Nurse mixed things up and had Leonard as the primary defender on Giannis Antetokounmpo. The Greek Freak still got his, but everything became harder, and as the Raptors slowed the pace their halfcourt defense locked in. On the offensive end, Leonard just made plays when he needed to.

“He’s a great player, he made some very special plays, give him a ton of credit,” Bucks coach Mike Budenholzer said of Leonard.

For the Bucks, who had the best record in the NBA this season and a likely MVP in Antetokounmpo, this was a learning experience about their shortcomings — both his and the Milwaukee roster. He had 21 points and 11 rebounds, but he was not able to dominate the game like Leonard did in crucial moments, and when he couldn’t get to the rim at will his lack of a jump shot he has confidence in showed. Those kinds of lessons come with being just 24 and making a deep playoff run.

“In our minds, we feel he’s going to get a lot better,” Budenholzer said of the Greek Freak. “At 24 some guys are… I don’t want to say they are who they are, but at 24 some of the great ones were the same at 30 and 32 and so forth. Giannis we feel has a lot of room to grow.”

So does the roster around the Greek Freak. Antetokounmpo sat just 7:28 in this game, and that proved to be too much — the Bucks were -9 in those minutes. They lost by six.

Eric Bledsoe struggled again, with 8 points on 9 shots. Khris Middleton — who is a free agent this summer — had 14 points on 5-of-13 shooting.

Still, this is a good team on a learning curve. One with some tough decisions ahead for the front office, but a team on the rise.

They showed that early.

Milwaukee came out playing with a sense of desperation — it showed in their energy and second efforts on defense — and they raced out to a 15-point lead early in the second quarter mostly because they just hit shots. In the first half, the Bucks did not get the ball inside (only seven shots at the rim) but were 9-of-18 from three and hit 50 percent of their shots from the midrange. Antetokounmpo had 10 points and seven rebounds and Ersan Ilyasova surprised with nine points in the first 24.

That had the Bucks up 50-43 at the half, but it felt precarious. Then in the third, Milwaukee had an 8-0 run and the lead was pushed to 15 at one point. The Raptors were stumbling. Pascal Siakam hesitated on shots, not trusting himself. Danny Green trusted himself but couldn’t hit anything.

The tide turned thanks to Leonard. The Raptors finished third on 10-0 run — with Leonard scoring or assisting on every bucket — and the lead was down to 5 after three.

Early in the fourth was when Antetokounmpo sat again, and the Raptors went on a 7-2 run to tie the game at 78-78. That lead kept growing in a run that got to 26-3 for Toronto, then Leonard did this.

Milwaukee would not go away down the stretch, but Leonard kept making plays while Antetokounmpo and company got tight. Milwaukee could never get back in front.

For the Bucks, it’s a lesson.

For the Raptors, it’s the trip to the Finals they bet big on.