An action-packed first half was book-ended by two goals 40 minutes apart, Mike Jedinak stunning the sell-out crowd with an early opener before Craig Noone's equalised a minute before the interval.
Cardiff's goal led a charmed life with Wilfried Zaha's splendid effort hitting the bar and chances aplenty for Palace but half-time substitute Gunnarsson helped turn the tide for the Bluebirds before scoring his sixth of the season from close range.
The Eagles came into this match having scored in all-but one of their League games this season so it was perhaps no surprise when captain Jedinak nodded home after just 180 seconds.
But Cardiff's reaction was laboured to say the least and it took until the 16th minute for the Bluebirds to really set their sights on Julian Speroni's goal, Craig Bellamy's ambitious half-volley sparking cries of "top of the league, you're having a laugh" from the buoyant travelling support.
And the 1,190 behind Speroni's goal had every right to be boisterous given their team's start which they came incredibly close to extending in two first-half minutes.
First Glenn Murray's touch let him down as he raced clear and then Zaha's trickery bamboozled Kevin McNaughton down the Palace left and his right-footed curler crashed off the crossbar. When the ball bounced back to Yannick Bolasie his deflected drive forced Marshall into a fingertip save.
A minute later Palace were threatening yet again, Owen Garvan's free-kick forcing Marshall into a low-save.
At the other end only the combination of Peter Ramage and his keeper Speroni kept out Bellamy after the Welshman tried a cute lob after racing clear.
Just when it looked like the Bluebirds would go into the interval behind for the second successive home game they drew level. Bellamy's pace helped him get the better of Parr down the Cardiff left and his pull-back into the box was perfect for Noone to hammer a first-time effort into the top of the Palace net.
After an off-colour first-half display Malky Mackay shuffled his midfield at the break with Jordon Mutch being replaced by Gunnarsson. And his change seemed to work a treat, with the Iceland midfielder helping to stop the
constant stream of Palace chances.
And in fact it took 12 minutes of the second period for the next chance, Garvan's drive flying just inches wide of Marshall's near post.
Bellamy was Cardiff's biggest threat and the 33-year-old tested Speroni with a low drive from an angle from Gunnarsson's clever pass as the game reached the hour mark.
Cardiff were beginning to engineer more chances and that pressure paid off 27 minutes into the second half when Gunnarsson rose to head in Bellamy's right-footed corner via the underside of the bar. Only the reactions of Speroni stopped the home side extending their hard-fought lead, the keeper diving right to flick Whittingham's free-kick onto the bar.