As well as conceding a late goal, visiting West Ham United will feel even more aggrieved, having missed a penalty earlier in the match.
Both teams had good chances to open the scoring before the break, with Jermaine Johnson shooting wide for Wednesday, while Freddie Sears headed over the bar for West Ham from three yards out.
West Ham's best chance of the match fell the way of striker Sam Baldock three minutes after the restart. Winston Reid was fouled inside the area by Reda Johnson and Baldock stepped up to take the resultant spot-kick. However, Wednesday keeper Nicky Weaver guessed correctly to turn his effort away.
With the game looking to be heading for a replay, O'Grady scored a powerful effort from 12 yards out to break the deadlock.
The home side were forced to endure 11 minutes of injury time due to an injury suffered by their defender Julian Bennett, but they managed to hold on to put their name in the hat for the next round.