Andrea Bargnani scored 23 points for the Raptors, who snapped a 14-game road losing streak with their first win away from home since Jan. 5 at Cleveland. Oklahoma City had its six-game winning streak snapped.
Oklahoma City overcame a 10-point deficit at the end of the third to take a 93-90 lead with 1:31 left. However, Barbosa's 3-pointer with 38.5 seconds left tied it, and he assisted on Johnson's shot.
"It was a pick-and-roll play, but he was supposed to take it all the way to the basket," Johnson said. "They double-teamed him, he made a great pass and I was able to finish."
Oklahoma City had a chance to force overtime, but Kevin Durant's shot from the baseline was off.
James Harden scored 23 points for the Thunder, including eight during their fourth-quarter rally. Durant added 20 but shot 6 of 21 from the floor.
"We took some quick shots and some perimeter shots," coach Scott Brooks said. "Normally what we do is attack the basket, try to get to the free throw line and make plays from the inside-out. We missed a lot of shots that we normally make and we've been making a lot lately."
The Raptors went on a 10-0 run in the third quarter after Oklahoma City had tied the game at 48. With the Thunder's Kendrick Perkins and Nazr Mohammed on the bench for much of the quarter with foul trouble, Bargnani was 3 for 6 from the floor and added four more points from the line during the third.
He also anchored Toronto's post defense, which held Durant to 0-for-7 shooting in the third. James Johnson guarded Durant for most of the game and Toronto coach Jay Triano praised his effort in his first game against Durant this season.
"If there's a game ball, it's for James Johnson and the work he did on Kevin Durant," Triano said. "Kevin Durant had very few easy looks."
Triano said before the game he wanted to slow the game down and limit Oklahoma City's transition points. His team did just that, holding the Thunder to 10 fast-break points, including six through the first three quarters.
"That set the tone," Triano said. "We got back and stopped their penetration. This team excels and their confidence grows."
Oklahoma City used an 8-2 run early in the fourth quarter to pull within four. Then, trailing by six with 6:28 to go, the Thunder went on a 9-2 run to take the lead. It was punctuated by Serge Ibaka's put-back dunk of Russell Westbrook's miss with 2:50 to go.
Toronto's road skid matched the longest in club history, which was originally set March 22-Nov. 24, 2006. ... Harden has scored in double figures in a career-high 16 consecutive games, all off the bench. The streak also includes a career-high 26 points he scored against Phoenix on March 6. Since the All-Star break, Harden has averaged 18.9 points. ... The win was Toronto's first in Oklahoma City. It had lost four consecutive road games against the Oklahoma City/Seattle franchise, with its last win coming Jan. 20, 2006.