A double strike from Marco Gabbiadini sent Cardiff floundering to defeat at Ninian Park.
He netted contrasting goals in the tenth and 50th minutes to earn a shock victory for the Cobblers and while the Bluebirds equalised through Graham Kavanagh five minutes after Gabbiadini's opener they were unable to draw level despite coming close in the latter stages.
Former Sunderland striker Gabbiadini fired in a blistering 35-yard drive past a helpless Neil Alexander for the opening goal but City skipper Kavanagh brought the sides level with a looping header five minutes later.
It was Gabbiadini once again just after the interval who toe-poked the ball home from just five yards after the Bluebirds' Danny Gabbidon had headed a Jamie Forrester shot off the line.
City boss Lennie Lawrence changed to a five-man midfield as City chased the game but the Northampton defence with keeper Lee Harper outstanding, kept the homeside at bay.
Lawrence was full of praise for the 34-year-old Gabbiadini: "I saw him play like that ten years ago and he is the sort of player that once he sees a big crowd he has to show them what he can do.
"Our defence never got to grips with him or Forrester all afternoon and they dominated our defence.
"I don't know whether it was the hot day, whether my players think they are superstars or because Cardiff were near the top of the league, but I have to get the right mentality throughout the side as lessons have not been learnt from most of last season's home displays"
Northampton boss Kevan Broadhurst was understandably delighted with the result: "We started brightly and once we got in front we dropped off and competed well. At half time we thought we could win and though we were under a lot of pressure at the end we managed to hold on and earn what is a massive result for us."