Great Britain reached the Davis Cup quarter-finals after Canada's 17-year-old Denis Shapovalov was defaulted from the decisive match for hitting the umpire with a ball struck in anger.
Kyle Edmund had just broken serve to lead 6-3 6-4 2-1 when frustration got the better of Shapovalov.
A default followed, giving Britain a 3-2 victory in the World Group first-round tie in Ottawa.
Britain go on to face France away in the quarter-finals in April.
"It was a strange way to finish," said Edmund. "I've never been part of something like that."
GB captain Leon Smith added: "A bit of a surprise what happened at the end there and I feel for the young lad. He's a great talent and he's learned a harsh lesson today."
Vasek Pospisil had earlier levelled the tie at 2-2 with a 7-6 (7-3) 6-3 3-6 7-6 (7-5) win over Dan Evans that lasted three hours and 23 minutes.
Shapovalov 'must learn the lesson'
After the dramatic build-up provided by the fourth rubber, the decisive fifth looked to be heading for a relatively low-key conclusion as Edmund raced into a commanding lead.
Again, Britain had the advantage in terms of rankings, but Edmund also had five years and a growing bank of ATP experience on his side against the current Wimbledon junior champion, making his Davis Cup debut.
Shapovalov played much of the match in confident style, hammering down big serves and hitting flashing one-handed backhands, but his lack of experience showed with a handful of loose games.
With serve dominating, Edmund bullied the teenager with his forehand to earn the first two break points in game eight and Shapovalov offered up a double fault.
Edmund sealed the set with an ace out and wide, and repeated the formula in the second set - profiting from his opponent's errors to break at 5-4 and convert the set with another ace.
When Shapovalov framed a forehand wide to fall behind in the third set, there appeared little chance of a comeback, but that opportunity disappeared altogether when he angrily hit the ball off court.
It struck umpire Arnaud Gabas, giving the Frenchman a bruised eye, and after discussion with the team captains and match referee Brian Earley, the crowd were told that the tie was over as a distraught Shapovalov sat in his chair.
Canada's Davis Cup captain Martin Laurendeau said: "There's always a lesson to be learned from the good moments and the worst moments. If he wants to compete at this level he has to keep it together.
"Emotional control is the biggest factor in this game. He must learn the lesson and hope it serves him in the rest of his career."
John Lloyd, former Great Britain Davis Cup captain and player
Kyle Edmund has won this match but you don't want to win like this - it's a shocking way for it to finish.
This has taken a lot of gloss off for Kyle Edmund but he was going to win this match anyway. The incident looked worse the second time you saw it.
It was meant to go out of the stands, but Shapovalov got it completely wrong.
Russell Fuller, BBC tennis correspondent
Umpire Arnaud Gabas was taken to Ottawa General Hospital for a check-up suffering from bruising and swelling of his left eye. Shapovalov made an impressive apology: he spoke of his shame and embarrassment and promised he will never do anything like that again.
He struck the ball with a serious amount of force. It was reckless and will live with him, but hopefully there will be no long term effect on Gabas' ability to umpire matches.
It may even force a tightening of the rules. Too many (much more experienced) players hit balls towards officials and the crowd in frustration, and this is a reminder of the potential consequences.