Williamson sidefooted home from six yards deep into stoppage time, to end ten-man Doncaster Rover's resistance.
Martin Butler wriggled his way into the box and his left-foot shot was diverted into Williamson's path by Rovers goalkeeper Jan Budtz.
Rotherham, who were without Deon Burton their top scorer, who is set to join their neighbours Sheffield Wednesday, set about Doncaster early. John Mullin and Will Hoskins both should have done better with good early opportunities but scuffed their shots.
At the other end James Coppinger crossed for a Michael McIndoe shot which was blocked by David Worrell.
Gary Montgomery then did well to deny McIndoe as Doncaster threatened on the break. Lewis Guy had a good chance straight after the restart, but Montgomery was equal to it.
Hoskins then beat Budtz to the ball, but his shot was cleared off the line by Doncaster captain Steve Foster.
The game hinged on a 67th minute decision by referee Graham Salisbury.
Rovers striker Paul Heffernan, booked earlier for dissent raced into the area and fell under the challenge of Colin Murdock. The ref judged that Heffernan had dived and sent the striker off.
Rovers were then forced to hang on, but their resistance was finally broken five minutes into stoppage time when Williamson scored to help the Millers climb towards safety.