© PA Photos
The Welsh outfit had kept clean sheets in four out of their last five away matches and looked poised to do so again as they frustrated the Hammers for 77 minutes.
However, Carroll's second goal since arriving on loan from Liverpool broke their resolve and secured the hosts their first win in five matches.
Gerhard Tremmel had previously kept West Ham at bay with a string of fine saves, but Swansea rarely threatened themselves until after conceding.
Carroll linked up with Kevin Nolan to create several chances, the first of which called Tremmel into action with a low stop.
The Dutchman was also on hand to deny Nolan when the midfielder's near-post header was tipped behind.
Carroll was wasteful with a pair of attempts from good positions, firstly dragging a left-footed shot wide after being found unmarked by a Matt Jarvis pullback.
Just as it seemed Swansea were going to record their third consecutive goalless draw, Carroll angled a glancing header past Tremmel to deservedly snatch West Ham the points.