Peterborough United were beaten 1-0 by Barnsley at Oakwell as the Tykes kept alive their play-off hopes on a night that saw Chris Forrester see red and boss Graham Westley sent to the stands in the dying moments following a frustrating evening.
Posh defended brilliantly for long periods with Ben Alnwick terrific, but a last gasp Williams goal earned a narrow success for the Tykes.
The first 10 minutes of the contest were largely played in the Posh defensive third with the Tykes employing a high press against the Posh defence, however, despite long spells of possession, goalkeeper Ben Alnwick was untroubled during that period.
Shaquile Coulthirst glanced a header wide from a Marcus Maddison corner kick on 14 minutes.
Jon Taylor showed good pace to carry the ball from his own half into a dangerous area, but he dragged his right-foot shot wide of the target from around 20-yards.
Chris Forrester whistled a shot wide of the near post on 26 minutes after a good lay-off from the lively Taylor.
Alnwick produced a fine stop by his near post to deny Hourihane and seconds later produced an even better stop to claw a powerful Roberts header around the post as the half moved into the final 10 minutes.
On 41 minutes, Posh were reduced to 10-men as Chris Forrester was given two bookings within seconds, first for a clashing heads with Hourihane and then for his reaction of pushing the midfielder away in front of the official as the Barnsley man stamped on his foot.
Alnwick then produced a fine stop from close-range to deny Winnall and then produced more heroics to keep out Brownhill. Bostwick was booked for bringing down Isgrove as the half moved into stoppage time.
Posh made two changes at the break with Gabi Zakuani and Lee Angol replacing Oztumer and Maddison. Mawson was denied by Alnwick on 50 minutes after the defender cut inside onto his right-foot.
Brownhill saw a free-kick beaten away by Alnwick on 52 minutes while at the other end a strong run from Taylor was ended by a smart Davies save down to his near post.
Alnwick produced another good stop on the hour mark as he kept out a Winnall volley following a fine Hammill right-wing centre.
Bostwick fired inches wide of the target on 73 minutes with a bullet from distance as Posh came desperately close to an unlikely breakthrough. Zakuani was cautioned on 82 minutes for a foul on substitute Fletcher.
As the game moved into four minutes of added time, the home side found the breakthrough as a header from WILLIAMS was allowed to squirm past Alnwick and into the back of the net to keep the Tykes' play-off hopes very much alive.
Boss Westley was sent off in the dyng moments for something he said to the fourth official.
Barnsley: Davies, Williams, Roberts, Mawson, Scowen, Isgove (sub Chapman 65min), Hammill, Hourihane, Brownhill, Winnall, Toney (sub Fletcher 59min). Unused subs: Townsend, Nyatanga, Khan, McCourt, Tuton.
Posh: Alnwick, Almeida Santos (sub Da Silva Lopes 90min), Baldwin, Bostwick, Fox, Forrester, Beautyman, Taylor, Oztumer (sub Zakuani 46min), Maddison (sub Angol 46min), Coulthirst. Unused subs: Tyler, Samuelsen, Nabi, Williams.
Half-time: Barnsley 0-0 Peterborough United
Full-time: Barnsley 1-0 Peterborough United
Attendance: 8,886 (226 Posh fans)