Neath had stormed to a 29-5 half-time lead, scoring four tries, before Cross Keys ran in four of their own in the second period.
But Neath had done just enough, and the game ended with them 32-31 winners. That earned then semi-final tie against local rivals Swansea.
The Welsh All-Blacks ran in their first three tries - from second row Neil Edwards, winger David Evans and centre Luke Ford - within the first 20 minutes. Winger Kevin James added Neath's four try on the half-hour, before Cross Keys flanker Rhys Peebles pulled a one back just five minutes later.
But after the break, the Keys ran in four tries in the last ten minutes. Two tries came from winger Will Johnstone and with one each for replacements Stephen Woodward and James Egan. But it was not enough as Neath held on to secure the narrowest of victories.
Aberavon secured their passage into the semi-finals of the SWALEC Cup with a hard-fought 20-10 win over Newport, who crashed out at the quarter-final stage for the fourth time in five years. Aberavon will now face Llanelli in the semi-finals in three weeks time.
The away side dominated the opening exchanges and were unlucky not to score when captain Andrew Coombs lost control of the ball just yards from the line.
Aberavon absorbed the pressure and scored a breakaway try after 29 minutes when Chris Morgan ran half the length of the pitch and slipped a pass for Richard Thomas to run over.
Aberavon's defence resisted a Newport comeback and when wing Richard Carter went over despite a strong Martyn Thomas tackle the game was all but over.
Carter added insult to injury with his second try seven minutes later, before Tom Riley claimed a last minute consolation for the visitors.
Llanelli beat Glamorgan Wanderers 27-20, but neither a sending-off nor a late Wanderers comeback could stop Llanelli from booking their place in the semi-finals and a clash against Aberavon.
A try in each half for the Parc y Scarlets club was enough, with hooker Craig Hawkins going over with the first try in the 20th minute.
Straight from the restart, Glamorgan flanker Sam Warburton went up the other end to grab a try of his own, with the kicking of outside-halves Luke Richards and Scott Sneddon making it 18-13 to Llanelli at half-time.
The visitors then put themselves into the lead as centre Simon Rosser crossed on 45 minutes, before Llanelli full-back Dan Newton restored their advantage ten minutes later. The hosts had second row Dan Godfrey sent off with 12 minutes remaining, and survive a late surge from the Wanderers before Richards kicked a last minute penalty that saw the game end 27-20 in Llanelli's favour.
Swansea booked their place in the semi-finals with a huge 62-3 Win against the last remaining non-Premiership side in the competition.
With little to play for in the league, the three times champions will be relishing their semi-final with holders Neath.
Caerphilly, of division one east, matched their lofty opponents in the first twenty minutes, and held the lead after Codi Rees's fifth minute penalty.
The floodgates opened after 24 minutes when centre Micky Thomas ran over the line and three tries in ten minutes from Andrew Joy, Tim Evans, and Sam Kiely put the home side 22-3 up at half-time.
Caerphilly regained their defensive shape at the start of the second-half, but two tries either side of the hour mark from centre Mark Popham put the result beyond any doubt. Late scores from the superb Richard Kelly and Lee Bevan completed the rout.
James Dixon played a major part in the scoring with a personal haul of 15 points from six conversions and a penalty.