A stoppage time goal denied Brentford at London Road as Peterborough United earned a 2-1 win.
A Marc Laird goal inside the final 15 minutes looked like it would be enough to earn Brentford a point as they produced a fine second half performance.
The home side took the lead early on but Brentford stayed in contention and it seemed as if they had taken their chance to earn a share of the spoils.
But Jonathan Obika turned in a loose ball with seconds remaining to give The Posh the points.
The home side could not have made a better start - George Boyd lifted an effort narrowly over in the first minute and they were ahead within five.
Brentford conceded possession just outside their penalty area and Boyd darted into the box, he went between Pim Balkestein and Craig Woodman and went over.
Referee Bobby Madley pointed to the spot and Grant McCann chipped the penalty down the middle to give the home side the lead as Richard Lee dived to his right.
Brentford immediately hit back, stung by the goal.
Gabriel Zakuani made an important interception to stop Gary Alexander heading in and the striker had a shot blocked soon after.
Myles Weston headed wide before Joe Lewis made an unbelievable save to deny Marcus Bean, who met a Weston cross six yards out with a powerful downward header.
Weston volleyed wide soon after but Peterborough regained a modicum of control as the game headed towards the quarter hour.
The rest of the first period was fairly even, the hosts had more efforts on goal but Brentford had good openings and were just unable to make the final ball tell.
Lee Tomlin had a shot blocked and forced Lee into a low save before McCann chipped a free kick wide.
Lee made an important save from an Adam Clayton chip and McCann curled a free kick inches wide.
The Bees started the second half brightly and a Woodman free kick pin-balled around the box and inches over the bar early on.
Chris Whelpdale lashed over for the hosts but there were few early openings in the second 45.
Mackail-Smith fired over and Karleigh Osborne made a fine block from Tommy Rowe and although Peterborough would have felt they were on top, they hadn't put the game to bed.
And Brentford made them pay.
It looked as if Lewis would once again deny The Bees as he made superb low saves to deny Bean and Michael Spillane but the ball broke to Weston, he curled a shot against the post and Laird was waiting to slot home.
Lee saved from Mackail-Smith and Kelvin Langmead headed over but the goal invigorated Brentford and they ended the stronger.
For the last 15 to 20 minutes The Bees were by far the better side, they attacked at will, flooding forward and had chances to win the game.
Weston had a shot blocked and force Lewis to tip a curling cross-cum-shot over the bar.
Nicky Forster had an effort blocked when a corner was half cleared, Balkestein saw a header saved and Charlie MacDonald nodded a Bean cross wide.
A MacDonald header was scrambled away and the striker was inches away from heading in a Weston cross before Lewis saved at the feet of Forster.
Just when it seemed as if the points would be shared The Posh threw balls forward - Spillane blocked superbly from Mackail-Smith and Lee saved from Boyd but there was still time for the hosts.
Mackail-Smith's overhead effort dropped to Obika and he poked home from close range to win the game for Peterborough.
Peterborough United: Lewis; Little, Bennett, Zakuani (sub Langmead 16 mins), Rowe; Whelpdale (sub Mendez-Laing 79 mins), McCann, Clayton, Boyd; Mackail-Smith, Tomlin (sub Obika 52 mins)
Subs (not used): Collis, Wesolowski, Agard, Nana
Brentford: Lee; Spillane, Osborne, Balkestein, Woodman; Laird, Bean, O'Connor, Weston; MacDonald, Alexander (sub Forster 79 mins)
Subs (not used): Royce, Wright, McCracken, Bush, Diagouraga, Forster, Simpson
Bookings: Laird (32 mins), Osborne (89 mins) (sixth of season)
Attendance: 4,667 (186 Bees fans)
By Chris Wickham