Despite trailing 9-3 at the break the Galway side battled back and secured a 10-9 win at The Sportsground.
Three first-half Leinster penalties had given the champions the edge but Jack Carty recovered from an earlier miss to put Lam's side within six points at the interval.
A stunning second-half try from Kieran Marmion and a Carty conversion was enough to give Connacht victory and Lam was full of praise for his side's cohesion.
"I'm happy with the result. There's no doubt that there are things we can do better in there, we know it wasn't perfect, but we have to put it in perspective," said Lam.
"We've got two guys that started two internationals and three internationals, versus what is a whole Irish pack.
"Versus the experience of that backline, that's massive. It does highlight that it's all about teamwork.
"When you have a lot of young guys, it's really important that you have calm out there. We don't need to get erratic and panic. We trust our structures and we trust our system.
"We can beat anybody as a team. We shouldn't be where we are, but it's all about believing and working hard.
"Now we've got a tough one in Glasgow, it doesn't get any harder away from home. The top team [Leinster] and now the second top team."
Follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the GUINNESS PRO12
Guinness PRO12
Suite 208, Alexandra House,
The Sweepstakes
Ballsbridge, Dublin 4, Ireland