Luke Nelson's shot on the buzzer helped Great Britain qualify for the 2022 EuroBasket Finals after an 83-81 win against Germany in Podgorica.
The victory, coupled with France's win against Montenegro in Saturday's other group game, assured GB of a place in the Finals in September 2022.
Gabe Olaseni had 20 points and Nelson 17 to lead GB, who had led for the first 25 minutes of the game.
Ovie Soko and Myles Hesson added 12 points each in GB's third group win.
Nelson, who had hit his highest score for the national team – 26 points – in the come-from-behind win against Germany in Newcastle a year ago, plays in the German league and was again a constant threat.
GB began the game knowing they had to at least equal the results of hosts Montenegro to qualify for next year's Finals.
Gabe Olaseni top-scored for Great Britain with 20 points
They led 15-6 early on with two threes from Teddy Okereafor before the Germans, already assured of a place in the Finals as one of the four hosts, slowly reeled GB in, taking the lead midway through the third quarter and extending it to seven points before GB's dramatic late defensive stand.
GB made four steals in the last two-and-a-half minutes, producing scores for Olaseni and Soko, and with the game tied with five seconds remaining, Nelson drove the key off an inbounds pass and laid the ball in high off the glass left-handed for the win.
"At the end of the game it looks like I won the game for the team, but that was a team win from the first play of the game to the end," said Nelson. "We weathered the storm and down the end we played great team defence."
"I'm proud of the collective effort," said acting head coach Marc Steutel. "Those last two minutes down the stretch I just thought we made the right defensive plays at the right time."
France trailed until the last quarter of their game against Montenegro before winning 73-71 to ensure they and GB will go forward with Germany from Group G.
|Great Britain (q)||5||3||2||368||373||8||-5|
|q = Germany qualify as a host nation|
Eating With My Ex: Celebrity Specials: Famous exes come face to face to answer some awkward questionsLine of Duty series 1-5: You won't be able to stop watching this nail-biting show