KENNEBUNK — A youthful band of Rams dug in like tourney veterans when it mattered most Tuesday night in a Class A South boys’ basketball prelim game.

Eighth-seeded Kennebunk High rallied from an eight-point deficit in the fourth quarter and beat No. 9 Fryeburg Academy 67-58 in double overtime.

The Rams had not led since midway through the second quarter until Zack Sullivan’s 3-pointer that opened the second overtime.

Kennebunk (8-11) made 11 of 12 free throws the rest of the way and played tight defense to finally subdue Fryeburg (8-11), which lost seven straight to end the season.

It was Kennebunk’s first playoff win since a prelim victory in 2006-07. The Rams hadn’t even returned to the playoffs until last season, when they lost a prelim to Marshwood.

“It’s a great win to get, especially since I don’t think we’ve been to (the quarterfinal round) in like 10 years,” Sullivan said. “I think that (3-pointer) gave us a lot of momentum but it took a lot from everyone to get back in it. A lot of guys stepped up.”

Kennebunk will face top-ranked and unbeaten Greely at 8 p.m. Friday in a quarterfinal at the Portland Expo.

Sullivan led Kennebunk with 15 points. Tripp Bush scored 13 points with two critical 3-pointers late in the game. Dustin Ewy added 12 points and freshman Kyle Pasieniuk had 10 off the bench.

Fryeburg also had balanced scoring, led by Joe LeBrun with 11. Caleb Bowles and Cody Gullickson each scored 10, with Oscar Saunders and Ryan Hewes totaling nine points each.

Fryeburg methodically had taken command, starting with a tough three-point play by Gullickson to make it 20-20 with 3:35 left in the second quarter.

The Raiders were able to score inside and occasionally in transition while containing Kennebunk’s perimeter game, especially leading scorer Cameron Lovejoy (2 points through three quarters). Fryeburg led 25-23 at the half, 39-34 after three quarters and pushed the lead to 44-36 on a right elbow jumper by Bowles with a little over six minutes to play.

“We had a couple chances to get the lead to double digits,” said Fryeburg Coach Sedge Saunders. “If we’d built it a little more, then we could have used our ability to drive and we would have been the team getting to the line.”

But Lovejoy got loose for his only 3-pointer of the game, burly center Cole Hoffman made one free throw, and Pasieniuk knocked down a 3 after some good ball movement, quickly cutting Fryeburg’s lead to 44-43.

“They were doing a good job of fronting Cam and Sully, and they’re our scorers, everyone knows that,” Kennebunk Coach Barrett Belanger said. “So we started to set some screens to get some reversals and set things up, and we weren’t forcing it.”

Bowles made a 3-pointer only to have Bush immediately answer with a 3 of his own to make it 49-49. That’s the way regulation ended.

Bush repeated his tying 3-point trick in the first overtime, this time knocking one down just seconds after Hewes’ 3-point basket put Fryeburg ahead, 54-51. Again, neither team scored over the final minute, forcing the second overtime.

“Fryeburg did a great job of taking away Sullivan and Cam, and the rest of our team really stepped up,” Ewy said. “I’m really proud of Tripp Bush, who made some big shots for us and overall, it was a great team effort.”