Paul Taylor grabbed a dramatic late winner as Peterborough saw off Cardiff.
Don Cowie turned in a rebound for Cardiff, but Posh led at the break thanks to George Boyd's close-range header and Grant McCann's free-kick.
Peter Whittingham replied with an equally impressive free-kick, then Andrew Taylor played Aron Gunnarsson through to put Cardiff ahead once more.
But McCann scored a penalty after a Taylor handball, before Posh's Taylor sprung the offside trap to win it.
The Bluebirds have not won at London Road since 1986 and drew 4-4 the last time they met there in 2009.
The early signs were good that there would be another goal flurry as a frantic end-to-end opening set the tempo for the entire game, with Whittingham clearing off the line after Emile Sinclair was allowed a free header.
It was a huge let-off for the Bluebirds, who took the lead soon after when Gunnarsson's throw was flicked back to Cowie on the edge of the area and the midfielder unleashed a superb drive into the bottom corner.
But Posh turned things their way with two goals in the space of three minutes.
McCann's corner to the far post was flicked back by Ryan Bennett to give Boyd a simple finish, before the striker was fouled on the edge of the area and McCann's fantastic curling effort flew into the top corner.
Cardiff refused to lie down and Robert Earnshaw's 25-yard strike produced a fine save from goalkeeper Paul Jones, with the little Wales striker later hitting the post.
Posh were also denied by the woodwork when Lee Tomlin headed against the bar from Mark Little's cross.
Whittingham levelled on the hour, placing a delightful 20-yard free-kick into the top corner after Boyd had fouled Gunnarsson.
Cardiff continued to assert themselves and Andrew Taylor's outstanding delivery from the left was touched in from close range by Gunnarsson.
However, after laying siege to Cardiff's goal, Peterborough were handed a lifeline when McCann's fierce strike struck Taylor on the arm just inside the area.
The defender seemed to have scant time to avoid the flying ball, but referee Nigel Miller pointed to the spot and McCann sent David Marshall the wrong way.
Still reeling from that decision, the Bluebirds were left appealing in vain for offside as Peterborough substitute Taylor took Boyd's long pass and slotted past Marshall for an injury-time winner.