NEW CANAAN — After seeing a 22-point lead dwindle to just a two-point win over Newtown on Wednesday that left Stamford coach Zach Smith shaking his head, the team spent Thursday’s practice working on closing out games.

Turns out, that’s exactly what the Black Knights needed.

After Stamford took an eight-point lead into the half, New Canaan’s Tim Russo hit a layup midway through the third quarter, tying the game at 26-26 and capping a 10-2 run by the Rams.

While Smith was having déjà vu, Stamford’s Jelani Jackson was drilling an open 3-pointer, turning the momentum back to the Knights, who would go on to defeat the Rams 48-39 in front of a packed house in New Canaan on Friday night.

“We’ve been working on situational basketball in practice,” Smith said. “We still need work, but when it was 26-all and Jelani came down — and he’s been struggling — and he hit that shot, that 3 was the biggest shot of the game I thought. I’m very happy for him because he needed it for his own confidence, and we needed it.”

That would be the only shot Jackson made during the game, but it didn’t matter, the damage was done to a Rams (2-7, 2-3 FCIAC) team that has struggled to find offense this year outside of Tyler Sweeney (16 points).

“I didn’t feel like we executed our offense at all tonight,” New Canaan coach Danny Melzer said. “They did a good job defending us. To me, the play of the game was at 26-26; Jelani catches the ball and we decide to let him shoot, when we know, that’s what he does.”

Melzer, who coached Stamford the previous four seasons before leaving for New Canaan this year, thought his team would be better equipped to handle the Stamford attack.

“If there’s any team we were prepared for, it was this one,” Melzer said. “I thought we had our guys prepared, but when you let a shooter catch the ball and shoot with your hand down and no pressure, that’s just not paying attention to detail, and in varsity basketball paying attention to detail is the difference between wins and losses.”

Down the stretch, the Knights (3-5, 1-3) turned to leaders Nico Laveris and Tevin St. John to ice the contest.

Laveris, who scored the first eight points in the game for Stamford, finished with a game-high 22, while St. John (10) provided a calming presence and matchup problem all night.

“Tevin is tough to guard in this league because he is a big, but he can handle the ball,” Smith said. “He can blow-by, he can finish and he’s a really good passer — he’s the best passer on our team, so he really helps us out. And obviously, Nico is our senior leader, knocking down free throws and he hit a big 3 to ice the game.

“Those guys did what they’re supposed to do, they’re our two best players and they stepped up.”

While seeing Melzer on the sideline opposing Stamford was certainly different, the coach said that once the game starts, all that matters is wins and losses.

“It was an emotional pregame,” Melzer said. “But once that ball goes up in the air it’s a basketball game; I’m coaching to win, we’re playing to win and I’m disappointed we lost like I would be any other time we lost. I’m glad it’s behind us and we can focus on the rest of our season.”

aparelli@bcnnew.com @reportedbytheAP

STAMFORD 48,

NEW CANAAN 39

STAMFORD (3-5, 1-3 FCIAC)

Nico Laveris 7 5-8 22 Jerome Atkinson 1 3-4 5 Rich Scott 1 0-0 2 Jelani Jackson 1 0-0 3 Tevin St. John 4 2-2 10 DeAngelo Malcolm 1 4-4 6. Totals: 15 14-20 48.

NEW CANAAN (2-7, 2-3)

Nick Crovatto 1 0-3 2 James Crovatto 2 2-2 7 Tim Russo 4 0-0 8 Tyler Sweeney 7 0-0 16 Austin Bell 1 0-0 2 Luke Crawford 1 0-0 3 Matt Brand 0 1-2 1. Totals: 16 3-7 39.

STAMFORD11 13 9 15—48

NEW CANAAN 9 7 10 13—39

3-pointers: S—Laveris 3, Jackson; NC—Sweeny 2, J. Crovatto, Crawford.