Gardner's goal - via Robert Green's blunder - capped a dramatic comeback by Alex McLeish's side who had fallen 3-1 behind on aggregate after Carlton Cole's superb first-half strike.
Lee Bowyer and Roger Johnson forced the game into extra-time before Gardner's moment of glory earned a 4-3 aggregate win.
West Ham were the better side in the opening 45 minutes with Cole causing plenty of problems.
But Blues were transformed after the interval with substitute Nikola Zigic causing plenty of problems after his half-time introduction and with Barry Ferguson pulling the strings in midfield.
The Hammers were forced to defend desperately for long spells but eventually cracked under the pressure.
West Ham started well and almost caught out the home side on the counter attack when a fine pass from Mark Noble allowed Zavon Hines a run at goal.
But Ben Foster was well placed to block the shot from a wide angle.
Cole then should have done better when he fired over from inside the area after latching onto a ball over the top from former Blues defender Matthew Upson.
Liam Ridgewell made a crucial interception to cut out a cross from the by-line by Cole as the Hammers started to enjoy a spell of pressure.
Then after 31 minutes a superb strike from Cole put the Hammers ahead on the night and 3-1 on aggregate.
The England striker was allowed time 35 yards out to line up his shot but there was no doubting the quality of the strike as it flew past Foster into the net.
Blues tried to retaliate and Green punched out an effort from Matt Derbyshire and clung onto a Seb Larsson free-kick.
But Johnson was relieved when the ball struck his knee inside the Blues area and hit the outside of a post with Foster beaten.
McLeish made a half-time change with Derbyshire making way for Zigic.
Gardner was unfortunate after 53 minutes when his 25-yard drive hit the inside of a post and flew across the goal without crossing the line.
Blues tried to build up some momentum and a deep cross from Ridgewell was headed across goal by Jiranek but Jerome was unable to keep down his shot which flew wide.
Blues' pressure was now relentless and Green turned a Ridgewell header around the post from Larsson's corner.
Then after 59 minutes Bowyer reduced the arrears.
Another Larsson corner was not dealt with by the Hammers and the ball broke to Bowyer who hammered the ball past Green from 12 yards out.
Blues were almost caught on the counter-attack when a low cross from Cole just evaded the run into the box of Hines.
West Ham were hanging on desperately to their lead and Green did well to turn aside a shot from Ferguson which flew through a ruck of players.
The home side were in complete control and Green was booked for time-wasting.
Green tipped over a Jerome header from Larsson's corner and after 79 minutes Johnson brought Blues level.
Bowyer supplied the cross and Johnson rose above the Hammers defence to head past Green.
Jerome could have won the game for Blues in normal time but Green smothered his low shot inside the box.
Ferguson and Dyer were both yellow carded in the final minute after squaring up to each other.
Then in the dying seconds Green fingertipped Gardner's low drive onto a post.
But Gardner was not to be denied after 94 minutes although Green should have done better.
His swerving shot was well struck but Green looked to have it covered only for the ball to slip away from his grasp into the corner of the net.
Parker showed good control in the box but shot over and Dyer shot over when well placed inside the box.
Tomkins and Cole were booked for dissent early in the second period of extra-time.
Foster held onto a scissor kick from Cole and Green denied Murphy when put clear by Ferguson.