Jurgen Klopp's side would have broken the club's record unbeaten run in all competitions, which had stood since 1982 if they avoided defeat in east London.
But instead, Alisson's disastrous display condemned Liverpool to a first loss since Real Madrid beat them in the Champions League quarter-final first leg in April.
Liverpool hadn't lost in the league since Fulham won at Anfield in March.
It was a day to forget for Alisson, whose own goal put West Ham ahead in the first half.
Trent Alexander-Arnold equalised with a brilliant free-kick, but Alisson was at fault again as Pablo Fornals and Kurt Zouma struck for the Hammers after half-time.
Divock Origi got one back for Liverpool, but it wasn't enough to preserve their long unbeaten streak.
Liverpool dropped to fourth place in the Premier League as West Ham climbed above them into third place.
The Reds are four points behind leaders Chelsea, while West Ham are only three adrift of Thomas Tuchel's men.
West Ham's first league win against Liverpool since 2016 was also their manager David Moyes' maiden league success against Klopp at the eighth attempt.
Moyes has worked wonders in his second spell at West Ham and a challenge for a Champions League place will be in their sights if they can maintain this level of performance.
It took just four minutes for West Ham to take the lead with a controversial opener.