A terrific first-half performance helped Ipswich end Cardiff's eight-match unbeaten run.
Cardiff fought back strongly after slumping 2-0 behind, but Ipswich held on to take victory and move above their opponents in the table.
Ipswich started better, with Jim Magilton's delivery causing Cardiff all sorts of problems, while Shefki Kuqi squandered three opportunities.
It was no surprise when substitute Tommy Miller put Ipswich ahead from the penalty spot in the 29th minute.
The second goal came only four minutes later as Jermaine Wright's cross found George Santos, who had a simple task to knock the home from close
It looked comfortable for Ipswich, but the Bluebirds pulled a a goal back in the 58th minute from the spot.
A penalty was awarded against Fabian Wilnis - a decision that mystified
Ipswich - and Robert Earnshaw converted it to record his 100th goal for Cardiff and 22nd of the season.
Lennie Lawrence's team pressed for an equaliser with Peter Thorne and Earnshaw having half-chances, but with 10 minutes left Ipswich restored their two-goal cushion.
Alexander flapped at a Westlake cross and Chris Bart-Williams produced a cool finish from 12 yards.
Thorne gave City hope with a header six minutes from time but Ipswich held on.
Cardiff: Alexander, Croft, Vidmar, Gabbidon, Barker, Gray,
Langley, Bonner, Robinson, Earnshaw, Thorne. Subs: Gordon,
Campbell, Boland, Prior, Margetson.
Ipswich: Davis, Wilnis, Naylor, Santos, Richards, Westlake,
Bart-Williams, Wright, Magilton, Bent, Kuqi. Subs: Price,
Armstrong, Miller, Reuser, McGreal.
Referee: A Hall (West Midlands).