WINDHAM — With the game on the line, Gorham won at the line.

The Rams sank 14 of 18 free throws in the fourth quarter – including five of six in a crucial late two-minute span – to hold off Windham 66-58 in an emotional SMAA boys’ basketball game Friday at Windham High.

Gorham (3-1) went 28 for 33 from the foul line, led early by reserve Spencer Ruda, who went six for six in the first quarter, giving the Rams their first lead, 7-6, and sparking an 10-2 run from which Windham never quite recovered.

“I wish we’d have had a better start,” said Windham Coach Kevin Millington. “We settled in and ground our way back in, but we had a big crowd, the kids were amped up and I think trying to do a little too much early on.”

Not that you could blame them. The school held a pregame salute to the community for its support shared all week, as Windham and Raymond schools were closed for two days while authorities investigated threatening emails administrators received Monday.

On Tuesday, police made an arrest and schools reopened Thursday.

Gorham was able to capitalize on Windham’s nerves, building a 15-8 lead after one quarter and a 35-25 lead at halftime.

The Eagles (3-2) trimmed the Rams’ lead to six, 40-34 with about four minutes left in the third and kept it to eight after three, 50-42.

With about 1:50 to play, Markus D’Andrea’s drive through the lane capped a 12-5 Windham run to cut it to 61-58. But in the final minute, Gorham’s Cody Elliott went three for four from the line and Sam Kilborn made two free throws to put the game out of reach.

“We played a pretty solid game all around,” Gorham Coach Mark Karter said. “You win and lose games at the foul line so I think we made some big shots down the stretch.”

Nick Thibeault led Gorham with 20 points, nine rebounds and two blocks. Billy Ruby added 10 and five boards, while Tyler Bernaiche had 10 points and three rebounds. Ruda scored nine points – all from the free-throw line.

“We practice free throws a lot,” Ruda said. “I take about 30 after practice every day. I knew we were going to hold on tonight. Everyone stepped up.”

The 6-foot-5 Kilborn (four points, six rebounds) made his return after missing two games because of a knee injury suffered in the opener, a 60-51 win at Marshwood.

“It felt great to be back,” Kilborn said. “I didn’t do very well, I was a little rusty.”

Rusty or not, Kilborn’s mere presence opened up the floor for the Rams, Millington said. That led the Rams to the foul line.

“That was the difference in the game, they hit their layups and their free throws when they had to,” Millington said. “I’m really proud of how our guys just kept grinding back.”

Kevin Weisser led the Eagles with 22 points and eight rebounds, three blocked shots and three steals.

D’Andrea had eight points, four assists and three steals. Troy Davis and Kyle Kilfoil each had six points.

“They have such great shooters, with Weisser and D’Andrea, they’re never really out of a game,” Karter said. “I was happy we were able to finish it off.”