Harford Tech senior guard Darius Dangerfield weaved through a cluster of Manchester Valley defenders in the lane and made a layup with three seconds remaining.
That basket lifted the visiting Cobras to a 62-60 victory over the Mavericks to spoil the home team's Senior Night.
Dangerfield also had a layup with 23 seconds left that tied it.
"We feel Darius is one of the top guards in the state," Harford Tech coach Bill Jones said a player who finished with a team-high 20 points. "He is averaging 24 points a game. We just wanted to put the ball in his hands and let him do it. And tonight he came through."
It looked like it would be a good night for Manchester Valley (8-13).
The Mavericks led for most of the fourth quarter and was ahead 54-47 with 4:30 remaining when Brandon Kirby sank a pair of free throws. Manchester Valley led 56-51 about a minute to go, but only scored four points the rest of the way.
Harford Tech (15-5) cut the margin to 58-56 on Jawaun Lucas' free throw with 1:42 left. Lucas then tied it at 58-58 on a put back 40 seconds later.
Two free throws from junior guard Bo Schene, who ended with a game-high 23 points, gave his team a 60-58 advantage with 29 seconds remaining.
After Dangerfield tied it at 60, the Mavericks turned it over for the third time in the final two minutes. He scored again 20 seconds later, but the hosts had one last chance. A desperation shot, however, was off the mark.
"We were feeling good for most of the game, but at the end we just fell apart," said Manchester Valley senior forward Chandler Breeden, who finished with 14 points.
The Mavericks trailed 42-38 with 2:22 left in the third quarter, but closed the period on 6-0 run as Breeden had four points during that stretch. Manchester Valley rode that momentum into fourth quarter, outscoring the Cobras, 10-5.
The stretch, though, that Manchester Valley coach Bernie Koontz will remember is the one that his team had that ended the game.
"You have to be able to handle things in the last two minutes of the game," Koontz said. "We didn't handle it with a lot of composure."
Manchester Valley came out in the first quarter with a lot of intensity, and it was the seniors that helped get Manchester Valley off to a good start.
Breeden scored eight points and Dan Johnston hit a 3-pointer during the Mavericks' opening 11-4 run.