Neil Ashton sent Wrexham into the FA Trophy semi-finals as they edged Halifax Town at the Shay Stadium.
Torquay United now await Wrexham in a two-legged tie, with the matches to be played on 21 and 28 February.
Halifax and Wrexham had met twice already in the Conference this season, sharing a 2-2 draw at the Shay and a 0-0 draw at the Racecourse Ground.
But Dragons captain Ashton found a winner, arriving at the back post to side-foot Kieron Morris' cross home.
Wrexham manager Kevin Wilkin told BBC Radio Wales: "I'm delighted, we've come here and taken the game to Halifax who are a really strong side at home.
"It was a difficult surface to get the ball down and play on, but we showed great quality and were right on the front foot from the word go.
"The goal was probably as good a goal as we've scored all season, the way we broke and people's awareness, and the finish at the end was superb."