Johnson's eye-catching second-half strike was enough to sink the Welsh side, who only had themselves to blame after missing out on the point they needed to be assured of the season-ending shootout.
Cardiff's anxiety to preserve a point and seal a play-off spot saw them make a nervy start and Wednesday went worryingly close to breaking the early deadlock.
Darren Potter curled a 25-yard free-kick over the top after Johnson had earned it with a mazy run.
And when James O'Connor produced a neat cross into the area from the right, Marcus Tudgay's header went close.
Leading scorer Tudgay raced into the area to volley a high ball and when Cardiff keeper Tom Heaton clattered him, there were anxious glances at the referee from the visiting players.
The Welsh side had sight of Lee Grant's goal when Michael Chopra latched onto a ball into the area but the Wednesday keeper made a comfortable save when the striker hit a tame effort.
Welsh fans were quietened by worrying scores that flashed in from other games, but seconds before the break a glorious opportunity went begging.
Roger Johnson produced a powerful header from Peter Whittingham's corner to beat Grant but hit the bar.
Darren Purse then smashed a shot from the rebound but it deflected over the top.
The tension remained in the second half and Bluebirds boss Dave Jones brought on top scorer Ross McCormack.
Twenty minutes from the end it was a wonder goal from Johnson that gave Wednesday the win.
Tommy Spurr's cross was headed out by Purse and Johnson lashed home an unstoppable shot from 20 yards.
Cardiff hurled everything forward in the dying minutes and Johnson had a great opportunity four minutes from the end but lobbed over with keeper Grant stranded and Stephen McPhail hit a 20-yard effort over.