Lam's side eventually turned round a 14-0 deficit to beat the black, green and gold 20-14 at Franklin's Gardens.
The win moved Bristol up to fourth in the Gallagher Premiership table whereas second-placed Saints missed the chance to put pressure on leaders Exeter Chiefs as they crashed to a second successive home defeat.
Bristol's tries came from replacements Henry Purdy and Lewis Thiede, with Callum Sheedy converting both and kicking a penalty, while Ian Madigan also added a penalty.
Harry Mallinder crossed for Saints, with James Grayson on target with three penalties.
Lam said: "We couldn't carry on playing like we did in the first half as we turned over so much possession and you can't play rugby like that if you want to set any form of standard.
"We conceded 18 turnovers in the first half so we had to flush that effort down the toilet.
"We said at half-time that we needed to be patient as our purple patch would come but even after that, we started kicking the ball away again, which made for a nervous finish.
"Our impact players made a big difference and we showed what we can do as we've come away from the top two sides in the Premiership, Exeter and Northampton, with wins."
One of the talking points of the game was Rory Hutchinson's high tackle on Joe Joyce as Bristol's replacement lock looked set to score.
Hutchinson was shown the yellow card - but Bristol felt a red card and a penalty try could have been given.
Lam added: "I trust the referees but Joe had a lot of momentum behind him and he would have taken some stopping although there were other defenders about.
"I've seen red cards for that type of offence.
"However, I was more concerned about what happened next as we didn't play with sufficient tempo when they went down to 14 men."