Lamb thought he had cost his side victory when he missed an earlier kick and Freddie Burns landed a drop-goal for the visitors.
But Lamb kept his nerve on his debut off the bench after Will James threw a punch to give away the 77th minute penalty as the Saints edged home 26-24.
With six players on World Cup duty, Northampton gave debuts to Paul Doran-Jones, Samu Manoa, Martin Roberts, Noah Cato and Tom May in a side captained by Phil Dowson.
Gloucester have not made major signings to replace the likes of Dave Attwood, Nick Robinson and England prop Doran-Jones, who was facing his former team-mates today.
They have instead shown faith in the likes of Jonny May, Freddie Burns and Charlie Sharples, who made his England debut against Wales last month.
The visitors squeezed the game's first penalty of the game inside the first minute following a foul on James Simpson-Daniel, but fly-half Tim Taylor's penalty flew wide of the far post.
Gloucester were determined to impose their attacking game from deep, Sharples and Olly Morgan making powerful runs that required sound defence to halt. Shuddering hits by both teams had the capacity crowd roaring.
Northampton showed their intentions in the 12th minute. Referee Andrew Small awarded their first penalty, but Stephen Myler kicked for the corner. The subsequent attack forced Gloucester to concede again, and Myler kicked the game's first points after 14 minutes.
Gloucester kicked their next penalty to touch, drove powerfully off the lineout and when Saints were penalised for going off their feet in the tackles, Taylor levelled the scores with a penalty after 18 minutes.
But Saints scored a superb try after 20 minutes. Greg Tonks scooped up the ball in midfield and broke, Myler took the ball towards the left touchline before foxing the defence with a cunning reverse pass inside, and Dowson thundered up into the gap his fly-half had vacated to score. Myler converted.
Tonks then undid his good work three minutes later, delaying an attempted clearance kick in front of his posts. Jonny May charged it down and won the race to score, leaving a simple conversion for Taylor.
Taylor fired Gloucester into the lead on the half-hour with a penalty after Saints were penalised at a scrum, then Gloucester's defence had to excel as Saints roared back in a game bristling with excitement.
The lead did not last long. Scrum-half Roberts marked his debut with a 33rd-minute quick tap-and-go that caught Gloucester napping as he scored by the inside of the post.
Myler again converted for a 17-13 lead which Saints took into half-time.
Gloucester lost key forward Alex Brown with a knock soon after the break and found themselves under the cosh.
Tremendous defence briefly kept the door shut, but ball-killing presented Myler with the opportunity to extend their lead with a 46th-minute goal.
The pressure intensified, and when Peter Buxton repeated the offence within minutes, referee Small flashed the game's first yellow card.
Burns replaced Taylor at fly-half, and within minutes had a chance to reduce the deficit, but his 55th-minute penalty was hooked wide of the left post. He had another opportunity on the hour, and this time made no mistake.
Northampton then brought on former Gloucester stand-off Lamb for Myler, who was immediately treated with an ice-pack to the back of his neck.
Just when it looked as if Saints were in control, Lesley Vainikolo broke through the middle, May found Sharples and the wing swept in on the left.
But with the chance to level the scores eight minutes from time, Burns rifled the conversion wide.
Then Lamb had a kick to widen the gap again on 74 minutes, but it died in front of the posts.
The cost of that miss was evident within 60 seconds as Burns made amends for his miss with a towering drop-goal.
Before the cheers had died, Lamb also made amends.
James stupidly threw a punch and Lamb made no mistake, arrowing home a penalty in a wonderful finale.
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The Barbarians are one of the top invitational rugby sides with a long history and classic rugby jersey.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Lions get ready for their matches with this green training jersey. It's what the players wear. Get in the Gear!
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
The Lions are ready to get their Australia tour underway. They arrive in Perth on Monday.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.