After a hugely physical contest on Saturday, Leigh looked on course for victory going into the final minute only for Matt Parcell to dive onto a loose ball and score.
The video referee requested about 30 replays of the preceding action to see if there had been a knock on but eventually ruled it a fair try.
Australian Brad Schneider, whose golden point drop goal had got Hull KR past Wigan in the semi-final, duly slotted the conversion to take the match into sudden-death extra-time.
Both sides missed with drop goal attempts before Leigh worked the ball to the former Sydney Roosters player Lam, who had also earlier scored a superb try, and the Papua New Guinea star got just enough on the ball with his left foot to seal victory.
"I can't believe it. That last try (from Hull KR) was heartbreaking. I feared the worst," said man of the match Lam, son of Leigh's coach Adrian Lam.
"I've kicked a thousand field goals in training over the last month and I don't want to say how many I've made."
Leigh wore gaudy shirts with a huge Leopard head on the chest and owner Derek Beaumont told the BBC: "I've never been through anything as hard in my life. It was the worst game of rugby for me watching that I've ever experienced.
"It's massive. I've got one word and it'll mean everything to everyone connected. Serendipity. It was our time and our turn.
"Little old Leigh, we've come down, there's leopard print en masse, what a feeling."
It was a tough defeat to swallow for Hull KR, who were also seeking to break a long barren streak having won the trophy for the only time 43 years ago.