Connelly's 13th-minute goal, which curled into the top corner, was enough to keep the Black Cats in 10th place - a point and a place ahead of Tottenham Hotspur, who have a match in hand.
Sunderland goalkeeper Jason Steele made a string of saves, including one from the Hammers' deadline-day signing Oladapo Afolayan on his debut, while Marcus Browne rattled the visitors' post late on.
West Ham remain in sixth, five points behind fifth-placed Everton.
West Ham: 12 Feb v Spurs (H) PL2
Sunderland: 11 Feb v Exeter (A) PL Cup