Armagh aren't known to have a poor disciplinary record but they conceded 23 penalties and had a player yellow carded as Rainey eeked out a 12-10 win.
Rainey started strongly but the Armagh defence held firm. Only a lack of precision prevented Armagh from opening the scoring.
Irish Under-19 ace Anton Lupari put Rainey ahead after sustained pressure around the home line but Armagh deserved to bring it back to 5-3 at half-time with a William Hazelton penalty.
The Magherafelt team attacked after the restart with Lorcan Quinn kicking intelligently but the home defence held.
It was Armagh who scored next when they broke from a scrum on the '22' and worked the touchline for Graham Crawford to score and convert.
This instilled Rainey into action and they gained the match-winning try when Neil Hastings crashed over for Quinn to goal. Armagh came back again for the remaining minutes but the visiting defence held.
Rainey coach Chris Campbell was glad to progress. He said: "We were shell-shocked when Armagh took that 10-5 lead but we settled. The last few minutes were tough but we played well."
Armagh coach David Dougherty was disappointed. He added: "We have a great bunch of lads that have never caused any trouble. Their discipline has been great and I'm proud of the way they performed. Congratulations to Rainey."