A Maryland team that had spent part of the past month losing close games to nationally ranked teams returned to its bench Sunday at Comcast Center, teetering toward another frustrating defeat.

There was confusion about the way the Terps had played in the final minute of regulation, which ended with No. 5 Virginia forcing overtime on a lob jumper off an inbounds play with less than a second remaining.

There was anger, pent up from other close losses in Atlantic Coast Conference play to then-No. 8 Duke and then-No. 4 Syracuse in February and -- most recently -- from a double-overtime defeat at Clemson a week before.

Yet, for the first time this season, there was also resolve.

Sophomore guard Seth Allen scored the first five points in overtime and led the Terps to a stunning 75-69 victory in the last ACC regular-season game Maryland will play before moving to the Big Ten next season.

“At the very end of regulation, I told Dez [Wells] that we were not going to lose,” said Allen, who shot seven of 17 from the field. “He looked at me and he said, ‘We have to take over,’ and that’s what we tried to do.”

Allen finished with 20 points for Maryland (17-14 overall, 9-9 in ACC), while junior guard Dez Wells scored all but two of his 18 points in the second half and overtime. The victory broke a 13-game winning streak for Virginia (25-6, 16-2).

The Terps, seeded eighth in the ACC tournament, next will play No. 9 seed Florida State in the second round at noon Thursday at Greensboro Coliseum. The winner will face Virginia, the top seed, at noon Friday in the quarterfinals.

Playing Sunday before a sellout crowd of 17,950 for only the second time this season -- with longtime coach Gary Williams sitting courtside for the first time since he retired -- the Terps finally made the plays that have eluded them for much of the season.

“It’d been devastating had we lost another one, Clemson was about as devastating as it gets,” Turgeon said. “We had to walk up three flights of stairs [at Littlejohn Coliseum], and it felt like 100 after that game.”

It would have felt like an even longer walk had Maryland not finished with a victory, and Turgeon is not sure he would of made it back to his locker room intact. Instead of the students storming the court in celebration, Turgeon joked: “If we had lost, they probably would have run over me.”

The Terps nearly gave away the game after taking a 62-58 lead with 2:39 left in regulation.

Maryland appeared to panic, as it has done in close games, as Wells missed a 3-pointer and was stripped, and sophomore forward Jake Layman barely hit the front rim with 27 seconds to go as the shot clock was expiring.

“We make it really hard on ourselves,” Turgeon said.