The Iron, beaten in the third round by Manchester United last season, had been frustrated by a dazzling display by Stanley goalkeeper Sean Murdoch before finally making the breakthrough with eight minutes left.
Stanley defender Kern Miller brought down Barcham and Dagnall made no mistake from the spot. Barcham then added a second in injury time with a 25-yard drive.
Before that, it was the Murdoch show as he made fine stops from Dagnall, Barcham, Eddie Nolan and Mark Duffy.
A fantastic finger-tip save to keep out Garry Thompson's drilled free-kick from 18 yards was followed by another fine stop to thwart Paul Reid from 12 yards before Dagnall won it from the spot.
Accrington, defeated in the League Two play-offs last season by eventual winners Stevenage, came close through Kurtis Guthrie and Ian Craney in the first half, but clear-cut chances were few and far between after the break and, despite a late treble substitution, they could not force extra-time, with Scunthorpe well worth their win.