Lamb's attempt from half-court found the basket for a 115-114 victory for the play-off chasing Hornets, who have won three in a row.
Kawhi Leonard, who had 28 points, looked to have sealed victory as he put the Raptors ahead with 44 seconds left to play, but Lamb's winner stunned the Scotiabank Arena.
— Charlotte Hornets (@hornets) March 25, 2019
The Hornets' run has moved them to within two games of the eighth play-off spot in the Eastern Conference.
The Houston Rockets clinched their place in the NBA's post season with a 113-90 win over the New Orleans Pelicans.
James Harden scored 28 points as the Rockets became the third team to clinch their play-off place in the Western Conference.
The Boston Celtics are still waiting to clinch their post-season place after they suffered a fourth consecutive defeat. LaMarcus Aldridge scored 48 points for the San Antonio Spurs, who won 115-96.
The Spurs have won eight of their last 10 games and are on course to secure a play-off spot in the Western Conference.
The Los Angeles Clippers are also closing in on clinching a place in the west and they recorded a fifth successive win to beat the New York Knicks 124-113.
Lou Williams scored 29 and Montrezl Harrell added 24 for the win, while Danilo Gallinari scored 26 points.
Elsewhere, Giannis Antetokounmpo scored 26 as the Eastern Conference-leading Milwaukee Bucks beat the Cleveland Cavaliers 127-105, while the Indiana Pacers breezed past the Denver Nuggets 124-88 in a battle between two teams already assured of a post-season place.
LeBron James will not be in the play-offs, but he scored 29 points as the Los Angeles Lakers beat the Sacramento Kings 111-106 and the defending champions Golden State Warriors moved back to the top of the Western Conference with a 121-114 win against the Detroit Pistons.