Soucek headed home from a James Ward-Prowse corner to give the Hammers a much-needed win after three defeats.
Jarrod Bowen struck a second-half equaliser for the hosts before Soucek's late winner at London Stadium.
Bowen also scored from a Ward-Prowse corner, rising highest to head home as the Hammers came back into the match soon after falling behind.
The home side went ahead early in the first half through Lucas Paqueta's driven finish.
The Brazil midfielder scored after just three minutes when Forest defender Nicolas Dominguez gave the ball away and it bounced perfectly for Paqueta to power into the bottom corner.
Forest were in front for the first time in the contest when Ola Aina's cutback into the box was pounced on by Anthony Elanga, who fired into the bottom corner, but Bowen equalised for the Hammers almost immediately before Soucek took the points.
The result sees West Ham climb up to ninth in the table, while Forest remain in 15th.
Ward-Prowse quality wins it for Hammers
The Hammers had been on a three-match losing streak in the Premier League before this dramatic victory.
After going ahead early on, they were controlling the contest before being pegged back by Awoniyi's equaliser just before the break.
Forest then took the lead and it seemed the Hammers were in for another frustrating afternoon.
However, David Moyes' side showed resilience to come from behind, winning a game in which they conceded more than once for the first time since January 2022.
Shortly before he scored the winner, Soucek dived to get his head to a Ward-Prowse free-kick but Forest goalkeeper Odysseas Vlachodimos tipped it over the bar.
Two pin-point corners from the England midfielder turned the contest around for the home side.
Both Bowen and Soucek were in the right place to head home as the dead-ball expert's excellent deliveries found their men, with Ward-Prowse up to five assists in the league this season.
"I think if I was James I would be disappointed that he hadn't had 15 or 16 assists by now because of the quality of the balls," said West Ham boss Moyes.
"I was thrilled with the opening couple of minutes and I was certainly thrilled when I heard the final whistle as well.
"In between it, there was a lot of good things, some not so good, but in the Premier League you have to take your wins when you get them.
"Today was a good win. We had a 1-0 win here on Thursday night against Olympiakos and now a victory today."
Unhappy milestone for Cooper as away blues strike again
Steve Cooper became the second manager to take charge of 50 Premier League games as Forest manager and will be disappointed not to have got at least a draw to mark the milestone.
The away side tried to use their aerial ability with Gibbs-White swinging crosses into the box but the West Ham defence held firm.
Cooper's side created some good chances, with Areola making a sensational save to deny Awoniyi, clawing a powerful header away from goal.
Awoniyi was unlucky not to score a second after some excellent one-touch passes with Elanga straight from Vlachodimos' goal-kick, but Areola once again came to the rescue.
Elanga was Forest's main attacking outlet and his clinical finishing inside the box gave the away side the lead.
However, just 123 seconds later, West Ham had equalised as Forest switched off from a set-piece and relinquished their lead.
Along with Rotherham United, Forest have the joint-fewest away league victories of any side in England's top four tiers since the start of last season, playing 26 matches and losing 18 of them.
"I'm disappointed, really disappointed. Not even to draw the game but not to win it because it's a game we could have easily won but we haven't won it," said Forest boss Cooper.
"We've lost the game on our own actions and when you think about that, you can't look past the goals which is an obvious thing to say.
"It's a real pity because after gifting them [West Ham] a goal we then do well to come back into the game, 1-1, we should go 2-1 up at the start of the second half."