CHARLOTTESVILLE, Va. (AP) – John Gilchrist had 22 points, including the go-ahead 3-pointer with 1:12 left in the second overtime, to lift No. 22 Maryland to a 92-89 victory over Virginia on Saturday.

Virginia had a chance to tie it with 18 seconds to go in the second overtime, but Elton Brown missed two free throws, capping his 3-for-13 showing from the line.

The Terrapins (16-8, 7-6 Atlantic Coast Conference), trying to rebound from a 19-point loss at North Carolina State during the week, twice saw the game extended when Virginia made 3-pointers on its final possession.

Gary Forbes hit the first one with 4 seconds left in regulation, and freshman Sean Singletary hit one with 21 seconds left in the first overtime.

The Cavaliers (13-11, 4-9) missed 15 of 27 free throws.

Maryland scored the first four points in the second overtime, but Singletary scored on a drive and a pull-up 12-footer, Forbes hit a free throw and Brown scored down low, giving the Cavaliers an 89-87 lead.

After Nik Caner-Medley made one free throw with 2:21 left, a play that also drew Singletary’s fifth foul, the Terrapins rebounded their own miss and found Gilchrist at the top of the key for his game-winner.

Gilchrist added nine rebounds and six assists for Maryland, while Travis Garrison scored 20 points and Caner-Medley had 19 points and 11 rebounds.

Singletary led Virginia with 23 points and nine assists. Devin Smith scored 22 points and Forbes, who also fouled out, added 17.

Maryland scored the first seven points in the first overtime and led 80-73 with 1:56 left, but Singletary and J.R. Reynolds hit consecutive 3-pointers for the Cavaliers. After Garrison scored inside to give the Terps an 82-79 lead with 32 seconds left, Singletary hit a tying 3-pointer.

Maryland had 20 seconds to play for a last shot, but Gilchrist waited until less than 4 seconds were left to make his move and Singletary knocked the ball away.

The Cavaliers trailed for the last 10 minutes of regulation until the final play, when Forbes hit a 3-pointer from the left side with 4 seconds left, pulling the Cavaliers even at 69-all and forcing the extra session.