With both sides sitting second in their respective divisions, Megson and Hammers boss Sam Allardyce have admitted that winning promotion is their main priority, though the Owls manager will be proud of his team's display against the Championship high-fliers.
However, Allardyce will be left ruing Baldock's failure to convert from 12 yards before Weaver's fingertip save pushed the former MK Dons striker's angled shot onto the woodwork.
Having used the game to give run-outs to several of his fringe players, Allardyce may not have been surprised to see a lack of fluency from his much-changed team in the first half.
And his side should have been behind when Owls attacker Jermaine Johnson spurned a golden opportunity for the hosts.
OWLS AND HAMMERS FA CUP WINS
1896 - Sheffield Wednesday
1907 - Sheffield Wednesday
1935 - Sheffield Wednesday
1964 - West Ham
1975 - West Ham
1980 - West Ham
The Jamaican did everything right as he cut inside the West Ham defence but, as stand-in Hammers keeper Boffin went to ground, he somehow missed the target with the goal at his mercy.
Wednesday were enjoying particular success down the right flank with James Tavernier,
on loan from Newcastle
, testing the credentials of West Ham's 17-year-old left-back Dan Potts.
Tavernier fashioned the first chance of the game when he flashed a shot across Boffin's goal and then beat Potts, son of former Hammers captain Steve, to whip in a right-wing cross which just evaded O'Grady.
But the much-changed visitors did have plenty of possession with Jack Collison providing their impetus. The Wales midfielder broke forward to create his team's best chance as Sears looped a three-yard header over Weaver's goal shortly before the break.
However, there was a lack of cohesion from their makeshift side and they created little until Winston Reid tumbled under the challenge of Reda Johnson in the Owls box with referee Keith Stroud immediately pointing to the spot.
Baldock, who has failed to score in his last nine games, could not convert before O'Grady lashed home when alone in the Hammers box.
Wednesday defender Julian Bennett had been stretchered off after a nasty-looking collision and it meant there was 11 minutes of injury-time for West Ham to find a leveller.
But the Owls hung on as Megson won the battle of the former Bolton bosses.
Sheffield Wednesday boss Gary Megson said:
"We are all pleased when we get a result and we all suffer as one when we don't.
"This is a good afternoon for us, but another game at Hillsborough when we don't lose.
"We don't think so much about the opposition, we just want to keep the run going for as long as we can."
West Ham manager Sam Allardyce added:
"We did everything right apart from not finishing our chances and making a basic error that cost us the tie.
"The changes we made weren't the problem. The problem was not finishing the chances we had, the biggest one being the penalty."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.