In a game fit for an Hollywood script, Wrexham found themselves down within 64 seconds courtesy of an Oli McBurnie goal, before James Jones and Thomas O'Connor struck after the break to put them into the lead.
Although Sheffield United equalised through Oliver Norwood, the Championship team were reduced to 10 men when Daniel Jebbison was sent off, and Paul Mullin then looked to have sent Wrexham through to the last 16.
However, John Egan netted at the back post in the fifth minute of added-on time, cruelly denying the Welsh outfit what would have been fairytale progress into the fifth round.
After all the excitement ahead of one of their most high-profile matches in recent memory, Wrexham endured a nightmare start, conceding a goal after 64 seconds and losing two defenders to injury in the opening 11 minutes.
McBurnie netted Sheffield United's opener, meeting a corner with a header to stun the hosts, and no-one could have foreseen Jordan Tunnicliffe and Aaron Hayden being withdrawn through injury.
To Wrexham's credit, they eventually settled and proceeded to threaten the Sheffield United goal, but the better chances were coming at the opposite end with Mark Howard needing to parry Jebbison's well-struck effort away from goal.
Although chances dried up as the first half progressed, Mullin was spearheading the Wrexham attack to great effect, constantly pressurising the Blades' backline and forcing them into mistakes.
Having performed valiantly to remain at a one-goal deficit, Wrexham turned the tables after the restart, getting back on level terms in the 50th minute as Jones hooked home from close range after a Ben Tozer long throw had caused panic inside the penalty area.
The momentum was with the non-league side and they got their noses in front just after the hour mark, Sheffield United failing to deal with a corner before O'Connor clinically drilled the ball low into the net, co-owner and Hollywood actor Ryan Reynolds leading the celebrations in the stands.
While Sheffield United looked stunned, it was only momentarily as they soon found an equaliser, Norwood capitalising on the ball falling invitingly for him after a block to smartly convert into the bottom corner from eight yards.
Just when the Yorkshire outfit appeared to have the momentum, they were reduced to 10 men as Jebbison was dismissed for kicking out at Tozer on the halfway line, the incident spotted by the fourth official.
Despite Sheffield United remaining a threat, the onus was on the home side, and the Dragons came agonisingly close to edging back in front when Ollie Palmer drilled a shot against the underside of the crossbar when he should have scored.
However, that frustration turned to a combination of relief and ecstasy moments later. Good work from Sam Dalby down the right led to Wrexham creating a situation where they had men over, and Mullin kept his composure to send the ball under goalkeeper Adam Davies from 12 yards out.
The drama was not over, though, as Sheffield United dealt an heartbreaking conclusion for the minnows to set up the sequel at Bramall Lane. A corner found its way to the back post, where Egan got free of his marker to send a first-team effort inside the near post.