Shaun Johnson scored with the last play of a pulsating semi-final to put holders New Zealand into the World Cup final and break England hearts with a 20-18 victory at Wembley.
England looked to have done enough to dethrone the world champions after coming from 14-8 down to lead 18-14 with a 67th-minute try from man of the match Sam Burgess but the Kiwis had the last say.
Twenty-year-old wing sensation Roger Tuivasa-Sheck had earlier scored two tries, taking his total for the tournament to eight, to give the Kiwis a six-point lead but England displayed exceptional character to put themselves in a winning position.
McNamara gambled on a new half-back pairing of Gareth Widdop and Kevin Sinfield after axing Rangi Chase and he will be delighted with both players' contribution.
However, England's heroes were front-row pair Burgess and James Graham, who battled manfully to lay a victory platform, while full-back Sam Tomkins grew into the game to impose himself on attack.
It all began so promisingly when Burgess took a short pass from Graham and got O'Loughlin over for his third try in 11 Tests for his country.
Sinfield kicked the conversion and added a penalty on 24 minutes to put his side into an 8-0 lead.
The Kiwis, who had cruised untroubled into the last four, were suddenly behind for the first time in the tournament but their response was to produce a subliminal moment that got them right back in the contest.
Jason Nightingale palmed Kieran Foran's kick back from the left-hand corner and the New Zealanders moved the ball across the full width of the pitch.
Issac Luke looked to have ruined the move with a wild pass that was sailing into touch but centre Dean Whare brilliantly kept the ball in play for Tuivasa-Sheck to claim his first try.
Johnson kicked the conversion and levelled the scores just before the break with a penalty.
England found themselves under pressure at the start of the second half after conceding a string of penalties and they soon fell behind for the first time.
Johnson and Locke combined to get the ever-dangerous Tuivasa-Sheck into space and he produced a devastating finish for his second try.
Johnson was wide with the conversion attempt but made it 14-8 on 52 minutes with a penalty awarded for an obstruction by Widdop on Locke.
Referee Ben Cummins awarded five penalties against England in the first 15 minutes of the second half but when they finally got their hands on the ball they immediately scored their second try.
Graham once more demonstrated his slick ball-playing skills and combined with Sinfield to get centre Kallum Watkins slicking through a gap in the New Zealand defence.
Sinfield was off target for the first time but the try breathed fresh confidence into England as the crowd came to life.
O'Loughlin dropped Graham's pass short of the line and left winger Ryan Hall looked certain to score when put into a one-on-one situation but he lost his footing on the surface.
With Widdop, Sinfield and Tomkins growing into the game, England suddenly looked full of invention and it was no surprise when they regained the lead on 66 minutes.
Sinfield's pass to Burgess was timed to perfection to get the former Bradford man into a gap and he charged over for England's third try.
Sinfield's third goal put his side into a four-point lead and they almost scored again when second rower Ben Westwood found a gap and stretched out for the line only to lose his grip on the ball.
It proved a costly miss as the Kiwis piled on the pressure in the last 10 minutes.
England looked to have done enough to hold on for a famous victory when, in the last play of the pulsating match, Johnson went past Sinfield as he rushed to close down the play and went through a yawning gap to score the most important try of his career.