Fly half Cameron Clement was the hero of the hour when he kept his nerve to convert an injury time penalty to secure a 14-17 win.
With the Black and Ambers having already inflicted a heavy defeat on the Whites earlier in the season, the visitors must have feared the worst when fly half Tom Hancock kicked an early penalty goal after a Will Richards break forced their defence offside in midfield.
But Swansea tied up the scores 10 minutes later with a Nicky Thomas penalty goal when Elliot Frewen piled into a ruck from an offside position.
Things got even better for the visitors after 24 minutes when the pack showed its dominance to set up a platform for the backs to get the ball out wide for Clement to score a well taken try. Thomas missed the conversion.
Newport prop Jamie Jeune made a break through the middle but he was stopped by a high tackle and Hancock kicked the resulting penalty to narrow the gap to two points.
The home dominance up front continued and they were awarded another penalty when the pack drove their counterparts back the best part of 10 metres. This time Thomas was successful with his effort at goal as they trailed 6-11 at the break.
Clement, who took over kicking duties for the visitors, and Hancock exchanged penalties in what was a tight second half before Whites flanker James McKenna was yellow carded for killing the ball. The Black and Ambers made the man advantage count when substitute hooker Andy Brown crashed over to score in the corner.
Fellow replacement Scott Sneddon missed a number of chances to snatch the lead and was made to pay as Clement remained ice cool to kick his team into the last eight of the cup.