The Argentine finished sweetly in the 19th minute after being set up by Aaron Cresswell – who was later sent off after controversially receiving two bookings inside a minute.
Cresswell looked to have earned West Ham a 74th-minute penalty when Yohan Cabaye tripped him – but was instead booked for diving.
Moments later he was sent off for a second yellow card and West Ham were left hanging on.
Hammers keeper Adrian made a vital save in injury time to deny Connor Wickham’s back-post header from Andros Townsend’s cross.
Hammers boss Slaven Bilic and his players then celebrated wildly at the final whistle after securing their first win in six Premier League games.
Skipper Mark Noble said: “Obviously going down to 10 men seemed like an hour to play but the boys at the back, the whole team, defended well.