In this League Two battle of two clubs in crisis, it was the Millers who stole the points at Field Mill when Yates' lofted kick towards goal from the right-hand touchline, over 40 yards from goal, somehow dropped in underneath the crossbar and over the fingertips of horrified keeper Jason White.
It was a crushing blow to the Stags who now could be relegated on Tuesday night if Chester get a point against Stockport.
On a tense afternoon, top scorer Mickey Boulding and Nathan Arnold both forced first half saves from Andy Warrington as Stags stuttered to get their game going.
After the break, Boulding cut in from the right and forced another save from Warrington, before the home side were stunned by Yates' hammer blow.
White had to make a good save to deny Mark Hudson near the end and in stoppage time Hudson blazed over from five yards with only the keeper to beat.