Cardiff took the lead after 13 minutes through Charlton Athletic loanee Tony Watt's first goal for the club.
The forward mirrored Watt by ghosting past a Cardiff defender wide on the left but his curled effort found the far corner of David Marshall's goal, seeing the sides head into half time on level terms.
Scott Malone, who assisted Watt's opener, put the Bluebirds back in the lead after 53 minutes.
After playing a one-two on the edge of Bolton's box, Malone's shot struck Ben Amos before trickling into the net.
Heskey got a flick on Dobbie's pass which found Dervite, who rifled home from 10 yards out after 72 minutes.
Birthday boy Dobbie had the chance to put Bolton into the lead for the first time in the tie but dragged his shot wide from Madine's knockdown.
Kenwyne Jones found Pilkington in the box in the 80th minute, the Ireland international volleying in from close range to hand the Bluebirds the advantage once more.
Jose Maunel Casado saw red for a second bookable offence with a minute of injury time played as Russell Slade's side recorded an away victory.
Bolton remain at the foot of the Championship table, while Cardiff move into the playoff positions in sixth.