The Irish side are unbeaten in their last four GUINNESS PRO12 matches but went down 24-18 to Quins last weekend before bouncing back at the Aviva Stadium on Saturday.
Isaac Boss' try and a pair of Ian Madigan penalties gave them an 11-0 advantage although a Mike Brown score helped the visitors to a second-half lead.
However, Madigan's third penalty secured a 14-13 victory and put the Irishmen level on points with their opponents atop the pool.
And back-row forward Heaslip admitted there are plenty of improvements Leinster must make if they are to secure qualification.
"There is a little bit of relief but at the same time there's happiness that we got the win," he said. "There's happiness that the group is still within our control.
"We realise it was in the balance, obviously, but at the same time, for a lot of guys who haven't necessarily played a lot of games at this level, it will show them what happens when you make errors against a side like Harlequins.
"We made a defensive error off the back of that maul, which was a compounded error off the back of a scrum before that.
"That's what happens - you give teams scoring chances like that in this competition and they will put you under the pump. You have to defend well, which at times we didn't."
Meanwhile, Wayne Pivac singled out Rhys Priestland as the difference-maker after seeing his Scarlets team win the battle of the GUINNESS PRO12 sides against Ulster.
Priestland kicked 17 points as James Davies notched the Scarlets' only try as they triumphed 22-13 - Darren Cave crossing the whitewash for Ulster.
The result means the Irishmen can no longer qualify from their pool and Pivac insists that his fly-half's success with the boot was the key to the result.
"I thought Rhys played very well. He was getting good length on the ball with his kicking game, so that was very pleasing," said Pivac.
"At times, we got the better of them in those kicking exchanges.
"We had to get the result. We made it a bit hard for ourselves after a good start, but to get the win was fantastic.
"It's a tough group. The sides are pretty even, they are all quality sides, but certainly after this we are still in the hunt."
Elsewhere in the Champions Cup, Munster's record of never losing back-to-back round three and four matches came to an end as they went down 26-19 to Clermont Auvergne.
Flanker Damien Chouly grabbed himself a try double for Clermont as the men in red now face an uphill battle to qualify for the knock-out phase.
Munster aren't the only GUINNESS PRO12 side struggling to qualify as Glasgow Warriors were edged out 12-9 by Toulouse at a sold-out Scotstoun while Ospreys' comeback against Racing Metro fell short - 18-14 the final score in Le Mans.
And Benetton Treviso's search for a first win of the season goes on as Northampton Saints ran in 11 tries during a 67-0 thumping at Franklin's Gardens.
In the Challenge Cup, Edinburgh maintained their 100 per cent European record with a 24-6 win over London Welsh on Sunday while Newport Gwent Dragons also sit atop their pool following a 69-17 victory over Bucharest Wolves.
Connacht overcame an 11-point deficit to see off Bayonne 29-27 in France while Cardiff Blues couldn't make it back-to-back wins over London Irish - going down 34-23.
And despite late tries from Giambattista Venditti and Dries van Schalkwyk, Zebre lost 32-16 to Gloucester at Stadio XXV Aprile.
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