After Reece Oxford headed the Hammers into a third-minute lead from Joe Powell's corner, goalkeeper Trott saved brilliantly from Liam Millar and Matty Virtue to keep the visitors ahead at half-time.
Trott denied Virtue once more after the break but the striker made it 1-1 in the 54th minute when he fired high into the net after his initial effort was blocked.
Powell then scored the winning goal for West Ham with a curling free-kick in the 73rd minute.
The victory leaves West Ham seventh in the table with six points, while ninth-placed Liverpool have three points from four matches.
Two away wins from two for the U23s after this afternoon's victory in Liverpool 👊 pic.twitter.com/dnDFh5uVnG— West Ham United (@WestHamUtd) September 2, 2018