West Ham were reduced to 10 men when Masuaku was sent off soon after the break for spitting and the defender apologised for his conduct on Sunday.
On a day of typical FA Cup drama, Tottenham Hotspur were also eight minutes from tumbling out at League Two (fourth-tier) Newport County until a Harry Kane tap-in salvaged a 1-1 draw.
Elsewhere struggling Premier League sides Swansea and Huddersfield played out 1-1 draws with lower-division Notts County and Birmingham City respectively, leading to unwanted replays for teams whose priority is remaining in the top flight.
They have now beaten another English Premier League club West Ham United in the fourth round.
The Premier League side were already a goal down before the sending-off, with Will Grigg netting after just seven minutes.
Wigan's hero was the Northern Ireland global striker Grigg, who again found himself the subject of the Wigan fans' favourite chorus of "Will Grigg's On Fire" as he headed home after seven minutes and converted a second-half penalty.
"Pedro looks as if he's got a medial knee ligament", Moyes told the club's official website.
60th Annual Grammy Awards: Everything You Need to Know Before You Watch
Are you excited to watch the 2018 Grammy Awards, HollywoodLifers? He did however, tease another "very, very big performance ". The 60th Annual Grammy Awards will take place on Sunday, January 28, 2018 at Madison Square Garden in New York City.
"We had young players who didn't perform well enough but we had senior players who didn't help them and ultimately - Arthur - what he done was despicable and from that point of view".
Leicester City won 5-1 at League One Peterborough thanks to two goals each from Fousseni Diabate on his debut and Kelechi Iheanacho.
The first all-Premier League tie of the round saw Southampton knock out Watford 1-0 with a fourth-minute goal from Jack Stephens - the flawless way for the defender to celebrate his 24th birthday.
And after conquering holders Arsenal in the last round, Nottingham Forest went out with a 2-1 loss at fellow second-tier team Hull City, Jarrod Bowen scoring and providing an assist for Nouha Dicko.
The game would end 2-0 to the hosts, who were the better side throughout the encounter.
Rochdale are in danger of slipping into League Two but they earned a replay at home after a 2-2 draw at Championship side Millwall, while the tie between Sheffield United and Preston North End saw the Blades edge through 1-0, Billy Sharp scoring the victor with 10 minutes to go.