It appeared that the Hammers were going to be taken to extra time by the League Two side before Dimitri Payet curled a free kick into the corner from 25 yards to book a last-16 tie with Chelsea.
The 48-year-old is quoted by BBC Sport as saying: "We expected an easier win, with the greatest respect, and not to have to do it in the last minute.
"We went down to 10 men but we wanted to score before extra time and then, a great moment from a great player. We didn't play good but I thought we deserved to win."
The victory for West Ham ended a run of four successive defeats in all competitions.