BANGOR — In the waning minutes of the biggest game of his young life, Medomak Valley center Cameron Allaire decided to improvise.

The sophomore made three crucial plays in the fourth quarter to help his top-seeded Panthers rally past No. 2 Winslow 51-48 on Saturday in the Eastern Class B boys’ basketball final at the Cross Insurance Center.

First, Allaire grabbed a rebound and switched hands in midair to score a basket that cut Medomak’s deficit to 46-43. Seconds later he found himself with the ball in the post, then turned and watched as Winslow’s Bobby Chenard tumbled to the floor. Allaire hesitated, then drove in and made it 46-45.

Finally, once the Panthers (19-2) had grabbed a 51-48 lead, Allaire raced over to block Justin Martin’s attempt at a tying 3-pointer, despite the fact that his coach, Nick DePatsy, had instructed his team to foul before Winslow could get a shot off.

“I said, ‘All right, I’m just going to try and block him and hope it’s not a foul.’ It wasn’t what Coach said but it worked,” Allaire said.

“He drained quite a few in my face this game, but at least he didn’t drain that one.”

Allaire scored five of his 10 points during the Panthers’ closing 10-2 run. His only two field goals were perfectly timed.

“I just took one dribble back and I was too far underneath the basket, and I jumped up and got it in my left hand and threw it up off the glass, and it went in,” the 6-foot-6 Allaire said of his first basket.

“I’ve done it before but not like this. It had to go in; it went in.”

It’s the second regional title in three seasons for Medomak Valley, which will face Cape Elizabeth for the state championship at 9 p.m. Friday in Portland.

The Panthers got 18 points from Micah Williamson and 16 from Nicholas DePatsy, the coach’s son. The game turned when Medomak extended its pressure in the fourth quarter and started forcing turnovers. Zach Starr’s layup, his only basket of the game, gave the Panthers the lead for good.

“We just felt we had to get after it,” Nick DePatsy said. “When we get running we’re altogether a different team. They got us in a half-court game and that’s not our forte.”

Martin, a 6-6 senior, scored 28 points to lead the Black Raiders (18-3). The only time Medomak Valley had an answer for him was on the final play.

“It was very impressive,” Williamson said of Allaire’s finishing flurry. “He’s a pretty to-himself kid, just kind of goes out there and plays. He really showed up; he got fired up when we needed him.”