AUGUSTA — Boothbay boys’ basketball coach I.J. Pinkham has won more than 600 games and is a member of the Maine Basketball Hall of Fame, so he’s seen a little of everything.

But his Seahawks gave him one of his most improbable victories and produced one of the biggest upsets in this year’s tournament Monday.

Sixth-seeded Boothbay trailed third-ranked Waynflete by 16 points in the second quarter before charging back in a Class C South quarterfinal, closing with a 17-5 run to stun the Flyers 65-64 at the Augusta Civic Center.

Waynflete’s Diraige Dahia goes up for a shot guarded by Boothbay’s Steve Reny. Photo by Brewster Burns

“We’ve been down before and we knew we couldn’t get it all back at once,” said Pinkham. “We got back in the game, hung in there, and the kids did really well in the second half.”

A Kyle Ames 3-pointer gave the Seahawks their first lead, 62-61,with 1:17 remaining. The winning basket came with 17.6 seconds remaining when Elijah Gudroe set up Hunter Crocker for a layup that broke a 63-63 tie.

“They were guarding Kyle heavily because he made a bunch of 3s, so I snuck in there,” said Crocker.

Waynflete freshman Dominick Campbell was fouled with 4.8 seconds remaining and made the first of a 1-and-1 opportunity, but the second shot was off target.

The Flyers got a reprieve when the rebound went out of bounds off Boothbay, but they were unable to get off another shot, turning the ball over.

Boothbay’s Steve Reny (behind) and Waynflete’s Diraige Dahia attempt to retrieve a loose ball. Photo by Brewster Burns

The Seahawks (15-5) advanced to meet second-seeded Winthrop in the semifinals at 7 p.m. Thursday.

Waynflete (15-4) appeared unstoppable in the first half. Nine players scored and the lead reached 30-14 and 32-16. It was 42-29 at the break.

Boothbay began its comeback in the third quarter. Ames, who picked up his fourth foul midway through the quarter but remained in the game, hit a pair of 3-pointerss and a Steve Reny layup pulled the Seahawks within four points.

The Flyers took a 54-48 lead to the fourth quarter and immediately stretched it to 11 behind a 3-pointer from Askar Houssein and a layup from Musaid Mohammed. But Boothbay got the next 11 points to draw even at 59 on a foul shot by Gudroe with 2:17 to go.

Boothbay’s Hunter Crocker and teammate Nick Simpson, right, battle for a rebound with Waynflete’s Dominick Campbell. Photo by Brewster Burns

A Christian Brooks jumper put Waynflete back on top, but Ames answered with his fifth and final 3-pointer.

“I was a little lucky on that one,” Ames said. “I just let muscle memory take over.”

Reny added a free throw before a jumper by Diraige Dahia set the stage for Crocker’s winner.

Reny finished with a game-high 21 points for Boothbay, Ames added 18 and Crocker finished with 17.

The Flyers were paced by 12 points from Houssein and 11 from Dahia, but they turned the ball over six times in the fourth quarter and missed 6 of 9 foul shots.

“It’s a shock,” said Waynflete Coach Rich Henry.

“I think you have to tip your cap and say Boothbay did a great job. Coach Pinkham is an institution and he was able to get his kids to respond and react to our pressure very well. Then the ball started to bounce their way.”