The visitors had the better of the first half, as Ian Craney blasted wide in the very first minute and Terry Gornell also went close.
In a hard fought encounter on a boggy surface at Don Valley the Millers improved after the break and took command.
They went ahead when loanee Liam Henderson, who played for Watford reserves on Monday night and only signed hours before kick off, appeared to be brought down but forced the ball towards Omar Daley in the box who smashed home into the bottom corner.
Some good work by Andy Warrington kept Stanley out as he made two impressive saves, the best of which came when he tipped Craney's 20 yard shot to safety.
Daley then netted after a sweet interchange with Nicky Law but the goal was ruled out for offside, before Adam Le Fondre's low shot secured the home side's victory in added time.