Liverpool’s recent resurgence was checked with a stunning display from Avram Grant’s men, who are now only in the bottom three on goal difference.
Glen Johnson pulled one back to make it 2-1 in the final minutes but Cole settled it with a late third goal.
West Ham went into the match looking to build on last week’s heroic draw at West Brom, keenly aware a result against Liverpool would give them renewed hope in their battle to stay in the Premier League.
Parker’s half time team talk inspired the fightback that day and he backed up his words with actions on the pitch, scoring an impressive opener after 21 minutes.
Having exchanged passes with Thomas Hitzlsperger, the West Ham captain brilliantly flicked the ball past Pepe Reina’s grasp to give West Ham the lead.
The hosts got the second goal their first half display deserved when Ba headed home Gary O’Neill’s cross in stoppage time.
Ba, who seems to have settled well in east London, angled his header perfectly to leave Reina with no chance.
Ba almost added another on 52 minutes when his rasping drive just crept past the post while Luis Suarez brought a fine save out of Rob Green on the hour.
Liverpool finally started to wake up as the match entered the final 20 minutes and Steven Gerrard’s powerful effort stung Green’s palms.
Johnson then poked home Luis Suarez’s cross to set up a tense finale but Cole blasted home in the final minute to end hope of a Liverpool comeback.