Although it wasn't 40 pts that game had shades of when the Tigers led Parramatta 31-0 in 2012 with 14 mins to go and only won 31-30.
Interesting you brought this up. There are some matches that I still remember just like yesterday after all these years, and that is one of them.
Found footage of the last 14 minutes here:
Also, another match that followed a similar course: week 2 final between Sydney Roosters and North Queensland Cowboys in 2014.
Roosters led 30-0 after 30 minutes and looked like they were going to rack up a cricket score, before the Cowboys also went on a points-scoring rampage of their own to square it up at 30-all around the 56 minute mark.
James Maloney kicked a late field goal for the Roosters to win 31-30, eliminating the Cowboys from the finals.
Had the Cowboys won that night, they would've broken the record for the biggest comeback in Australian first-grade RL history (which is currently 26 points, coincidentally involving the Cowboys in 1998. They trailed 26-0 against Penrith, before winning 36-28).