Boyd unleashed an unstoppable 20-yard strike with his right foot just two minutes from the end to ensure Gary Johnson's League One side claimed a Championship scalp.
Bluebirds boss Dave Jones left loan star Craig Bellamy out of the squad for the tie, but the visitors hardly missed him during a dominant first half display.
A succession of chances went begging before Jay Bothroyd was left with a simple header with which to break the deadlock in the 31st minute after being picked out by a fine left wing delivery from Jason Koumas.
But Cardiff were made to pay for their failings in front of goal when Posh upped the ante in the second period.
Goalkeeper Tom Heaton pulled off fine saves to deny Craig Mackail-Smith and Boyd in the space of 60 seconds, but he was powerless to prevent Mackail-Smith hauling the hosts level with a rasping drive from the edge of the box in the 74th minute.
Bothroyd had penalty appeals ignored at the other end after going down under a challenge just before Boyd secured Posh's passage with his late stunner.