Ireland beat the United Arab Emirates by just two wickets thanks to a magnificent 80 from Gary Wilson and a 24-ball fifty from Kevin O'Brien in a hugely entertaining clash in Brisbane.
A century for the UAE's Shaiman Anwar (106 off 83 balls) had given Ireland a tricky target of 279 to chase down and having been 97-4 just after the halfway point of their innings, an upset looked to be on the cards.
But Wilson's intelligent knock and the fireworks from O'Brien, which included eight fours and two sixes, helped see Ireland to a win with just four balls to spare.
Ed Joyce (37) had earlier benefitted from a slice of luck in a bizarre incident when he appeared to be bowled by Amjad Javed, only for the bails to land back on top of the stumps after they had been hit.
Ireland - who won the toss and chose to bowl at The Gabba - made regular inroads into the UAE batting line-up with Paul Stirling (2-27) particularly impressing early on.
The off-spinning allrounder made the first breakthrough with opener Andri Berenger picking out Ireland’s captain Will Porterfield for 13 in the 12th over.
Stirling made it two in two overs when Krishna Chandran followed soon after for a duck and O'Brien (2-61) chipped in with a double strike of his own came in the 19th and 21st overs, dismissing Amjad Ali for 45 and Swapnil Patel for two.
But at 78-4, Anwar's arrival at the crease disrupted the bowlers rhythm with his counter-attacking display that included 10 fours and a six.
He lost partners Khurram Khan (36) - to George Dockrell - and Rohan Mustafa to Alex Cusack (2-54) as the UAE again lost wickets in a cluster and fell to 131-6.
But he found an able partner in Javed (42 off 35) - the pair putting on 107 runs, a record for the seventh wicket in a World Cup.
Both eventually fell to Max Sorensen (2-60) as the UAE pressed for big hits towards the end of their innings, with an impressive 147 runs coming from the final 15 overs as the Ireland attack bowled too short in the final overs.
Anwar took a particular liking to the returning O'Brien - spoiling his figures with 19 runs coming from his seventh over, the 48th of the innings - as he went through to three figures off 79 balls.
It left Ireland with a tricky total to chase in order to keep their hopes of qualifying for the quarter-finals alive and it got off to a worrying start when Stirling fell for just three in the second over.
Porterfield (37) and Joyce (37) rebuilt but neither looked fluent at the crease - the latter getting his fair share of luck with the stumps hit when he was on 16 and Mohammad Tauqir shelling a caught and bowled chance on 32.
But his luck eventually ran out in the 19th over as he edged an attempted drive off Javed through to the wicketkeeper. Porterfield and Niall O’Brien (17) followed not long after and at 97-4, Ireland looked in real trouble.
But a 74-run partnership between Wilson and Andy Balbirnie (30) helped lead the recovery and lay the platform for O’Brien’s big hitting in the final 10 overs.
O’Brien fell the next ball after going through to fifty - picking out the fielder at extra cover off the impressive Javed (3-60).
Still needing 36 from the final 32 balls, Ireland edged over the line with John Mooney falling for two and Javed's fantastic all-round day continuing by taking the catch for the crucial wicket of Wilson off Mohammad Naveed.
He had survived a huge lbw shout in the over before, with Javed seemingly trapping him plumb in front when attempting a sweep but on review the decision stayed with the umpire's call of not out despite the ball shown to be hitting the stumps - but just not enough of it.
When he did depart, Cusack and Dockrell got the remaining 12 runs required - despite some questionable running between the wickets - seeing them over the line with four balls to spare.
Ireland face South Africa next in Canberra on Tuesday and the UAE play India in Perth on Saturday in a wide open Pool B.
Former Ireland all-rounder Kyle McCallan:
"I'm hugely relieved as it's a bullet dodged. A defeat would have meant Ireland would have had to beat Zimbabwe and Pakistan [to make the quarter-finals] but Kevin O'Brien was magnificent, Gary Wilson was class and George Dockrell, whose batting has come on leaps and bounds, got us over the line.
"We took some options that weren’t great but we were composed for lots of periods of time, turned two into threes while running, and put in a very competent batting performance. However, our bowling has its limitations and we don’t have the pace of some other teams so we need to execute our plans better in that department going forward."
Watch highlights of Ireland v UAE on Sky Sports World Cup at 1pm, 3pm, 5pm and 8pm.