Rochdale ran out 1-0 winners over Shrewsbury on Saturday, ending their run of four games without a victory.
But it took a late strike from on-loan forward Tyler Smith to steal the points in the closing stages.
Dale are now 10 points clear of the relegation zone in League One, after the win at the Crown Oil Arena.
Smith's close-range finish came after a floated shot from Ian Henderson struck the crossbar, with the Dale forward reacting quickest.
The opening exchanges had belonged to the away side, after Eoghan O'Connell slid to deny Conor McAleny the chance to shoot.
McAleny also fired over from inside the Dale box, before Aaron Morley belted an effort from range straight at the away goalkeeper, Max O'Leary, who held it well.
Dale were thankful to a great save from Robert Sanchez, when Jason Cummings fired an effort at goal - before the goalkeeper again produced a fine stop to palm a Donald Love shot away.
Henderson almost broke the deadline when he met an Aaron Wilbraham flicked header, but the effort was over from close range.
Sanchez again proved to be on form, when Callum Lang hit an effort for the bottom corner - but the goalkeeper got down well to his right and kept it out.
But as the game was heading towards a stalemate, Henderson's effort struck the crossbar and Smith was there to slot the rebound home.
Do you have a story for us? Want to tell us about something going on in Tameside, Oldham or Rochdale? Let us know by emailing email@example.com , calling us on 0161 621 6515 , tweeting us @rev962 or messaging us through our Facebook page. All contact will be treated in confidence.