BOSTON — The Boston University Terriers are in desperate need of wins if they are going to earn a berth in the NCAA Tournament and try to defend their men’s hockey national championship.

They picked up a valuable win Friday night with a 7-4 victory over the University of Maine Black Bears.

The Terriers used second-period goals by Vinny Saponari and Nick Bonino to snap a 2-2 tie and third-period goals just 22 seconds apart by Zach Cohen and Colby Cohen (no relation) to break the game open.

BU improved to 12-2-3 overall, 9-9-2 in Hockey East, while Maine fell to 14-10-3, 11-7-2, after having its four-game unbeaten streak (3-0-1) snapped. It is also the most goals allowed by the Bears this season.

The teams play again tonight at 7.

Ross Gaudet staked the Terriers to a 2-0 lead with goals in the first and second periods. They were his fourth and fifth goals in the last five games.

Joey Diamond and David deKastrozza tied it up by scoring 2:17 apart in the second period, but Saponari’s power-play goal at the 16:03 mark broke the tie, and Bonino scored 2:36 later with just 1:21 left in the middle period.

Jeff Dimmen pulled the Black Bears within one at the 5:59 mark of the third period, but Zach Cohen answered just 1:26 later and Colby Cohen iced it.

David Warsofsky added a power-play goal before Robby Dee scored a consolation goal for Maine, his sixth in six games.

BU coach Jack Parker said one of the keys to the game was the fact “we were able to answer every time they scored. We didn’t allow them to get momentum.”

Dimmen had given the Bears a spark when he picked up a loose puck along the right wing boards, cut in front and backhanded the puck past BU goalie Kieran Millan.

But Zach Cohen’s goal was the turning point.

Kevin Shattenkirk raced down the left wing and fed a pinpoint pass across to Alex Chiasson. But his one-timer was kicked out by the alert Shawn Sirman, who had replaced Scott Darling at the outset of the period.

However, the puck spilled over to the far post when the unattended Zach Cohen simply had to tap it into the open net.

The pivotal goal came at the expense of Maine’s prolific top line of Tanner House, Gustav Nyquist and Brian Flynn, who were held to just one Flynn assist primarily by the line of Corey Trivino, Chiasson and Zach Cohen.

“They did a real good job on the Nyquist line,” said Parker.

“Our top line wasn’t our top line tonight,” said Maine coach Tim Whitehead.

“It was important for us to answer their goals. They came back to make it 4-3 and then it was 7-3,” said Colby Cohen, who extended the lead with a shot from the point that knuckled past Sirman.

“I didn’t get much on it. I’m thankful to the forward who screened in front,” said Cohen.

Warsofsky scored when he came off the bench onto a loose puck and fired a slapper that deflected in off a Maine stick. Sirman suffered a concussion on the play via a collision and had to leave the game.

Gaudet’s first goal came just 1:18 into the first period.

Sean Escobedo’s long diagonal pass intended for Joe Pereira jumped over the stick of Maine defenseman Josh Van Dyk.

Pereira broke down the right wing in a two-on-one with Gaudet before sliding it across to Gaudet, who simply had to sweep it into an empty net.

Darling made eight Grade-A saves in that first period and benefited from the goalposts on two occasions.

Shattenkirk’s screened power-play blast from the midpoint glanced off the post to Darling’s right six minutes into the period and, with just over a minute remaining, Pereira rang a wrister off the crossbar.

Gaudet expanded the lead 4:33 into the second period when he took a pass from Colby Cohen, dashed down the left wing and beat Darling with a shot from a bad angle that slipped through the goalie.

Diamond and deKastrozza tied it with goals 2:17 apart later in the period.

Thirty-one seconds after Maine squandered a two-man advantage that lasted 1:38, Diamond drove to the net and swatted home the rebound of a Kevin Swallow wrister that glanced off the shoulder of BU goalie Kieran Millan.

DeKastrozza tied it on the power play as a Josh Van Dyk point shot produced a scramble in front and deKastrozza pushed the puck over the goal line.

But Saponari gave BU the lead for good after House was assessed a tripping penalty as he parked himself at the top of the crease and roofed the rebound of a Colby Cohen shot over Darling on the backhand.

“That goal was huge,” said Parker.

Bonino made it 4-2 when he was allowed to cruise down the slot unmolested and fire a 12-foot wrister over Darling’s glove.

“We wanted to clean up our defensive play so we don’t have to rely on Scotty as much, but we were sloppy tonight,” said Maine sophomore left wing Spencer Abbott. “We had problems giving up goals after we had scored earlier this season. It’s one of the worst things in hockey.”

“I was disappointed with our effort.” said Whitehead. “We weren’t prepared to compete at the same level as BU. That was obvious when we didn’t capitalize on the five-on-three. That’s usually money in the bank. We were a little off tonight from our goaltenders to our defense to our forwards. But you’ve also got to give BU credit.”

“We weren’t ready to play tonight,” said Van Dyk.

BU outshot Maine 29-26.