Dagenham & Redbridge edged Rotherham in a thriller to move out of the Football League's relegation places.
Danny Harrison volleyed the Millers into the lead from 20 yards but Jon Nurse headed home a leveller.
The Daggers led when Mark Bradley deflected Abu Ogogo's shot home for an own goal but seconds later Alex Revell scored an equalising header.
But Scott Doe won it with a header before United's Michael Raynes was sent off for two bookings.
The hosts' win lifts them back above Plymouth into 22nd, while Rotherham are six points off the play-off places.
VIEWS FROM THE DRESSING ROOM
Rotherham United manager Andy Scott tells BBC Radio Sheffield:
"We've had more chances probably than we've had in two or three games, really good chances not just half chances, they were one-on-ones or shots in front of goal.
"Their keeper has made a great save, Lewis Grabban has missed one one-on-one in the first half, got one cleared off the line. It just didn't go in for us.
"We knew 1-0 at half time that if we performed the same way again that we would win win the game, but when you concede goals from set pieces as easy as that you've got no chance, especially against Dagenham.
"We knew they were going to chuck everything at us, we knew they were going to pump balls in and make things difficult for us. We should have dealt with it."