Having gifted Barnet a two-goal start Rochdale produced a thrilling comeback courtesy of an Adam Le Fondre hat-trick to book a trip to Forest Green Rovers at the end of the month.
The visitors profited from the first defensive howler by the home side after just 11 minutes when defender Rory McArdle misjudged a clearance from goalkeeper Lee Harrison, which allowed John O'Flynn to race through and calmly slot the ball past the advancing Sam Russell.
It got even worse for the home side on 20 minutes when, having failed to clear their lines properly, skipper Gary Jones tried to pass the ball back to his keeper but did not spot Albert Adomah who was left with a simple finish.
The home side brought on veteran target man Lee Thorpe at the start of the second half and with his help they pulverised Barnet into submission.
After a series of early second-half chances came and went a flowing left-wing move resulted in a low Tom Kennedy cross and a sliding far-post finish by Adam Le Fondre.
The home side drew level on 73 minutes with another flowing move and a well struck finish by Le Fondre from just inside the penalty area.
The winning goal came 13 minutes into extra-time when Le Fondre, who had a minute earlier been signalling that he wanted to come off due to injury, produced a stunning lob from the right-hand side of the penalty area.