Medy Elito hit an injury-time winner as Dagenham & Redbridge consigned Rochdale to a third consecutive defeat.
Both sides created chances in an open game but neither could take any until the hosts finally went ahead on 72 minutes when Andrew Tutte steered a 12-yard strike into the top corner.
Abu Ogogo's close-range finish made it 1-1 within three minutes.
Sam Williams then teed up Elito, who smashed the ball past goalkeeper Josh Lillis to earn the victory.
The result means the Daggers leapfrog Dale to go 13th in the League Two table.