The young Hammers made the most of their first-half opportunities as Swindon didn’t, with Joshua Ajala and George Earthy tucking home.
Glatzel netted twice and came painfully close countless more times in the second half, but one from Josh Landers between those saw them beaten.
Swindon will now have to beat Milton Keynes Dons in their final group match in order to advance to the knockout rounds.
Ian Holloway gave a first Swindon start to Harry Gray and Adam Murphy, amongst eight changes from the weekend. Filozofe Mabete, Ollie Clarke, and Billy Bodin were the only ones to remain in the line-up from the weekend’s draw with Colchester United.
Swindon were always going to have the physicality over their academy opposition, and imposed that inside a minute. Glatzel pressed high up the left to win the ball before Clarke and Murphy hustled the ball out to the right. Joel McGregor’s deflected cross came back to Murphy on the edge of the box, who forced a save from Krisztian Hegyi.
It may have been his first Swindon start, but Gray’s time at Melksham Town seemed to be serving him well. His speed cut out an attack at one end, before he showed it again to beat two defenders to the ball, before having a cross towards Glatzel stopped by Rayan Oyebade.
With West Ham looking to be expansive, Swindon were able to fizz passes around their shape and have some joy. However, in the opening 20 minutes, Hegyi had his action limited to the early save from Murphy and catching a tame Jamie Knight-Lebel header from a long throw.
But after one attack broke down with Ryan Delaney committed up the field, West Ham pounced. Mohamadou Kante broke up the right and tried to clip a ball into the middle, which Knight-Lebel headed away. That came to Earthy, who found Ajala to drill across Lewis Ward and into the corner.
Seconds late in the 27th minute, Glatzel broke away from his marker down the left and drilled a ball straight through the goalmouth. Princewill Ehibhatiomhan and Billy Bodin raced after it, but a touch from the defender took it away from them.
The Hammers could have doubled their lead after Ehibhatiomhan overran a ball in midfield. Preston Fearon picked it up and charged forward, slipping in Josh Landers, who was only denied by the spreadeagled Ward.
After having the initial warning, just before the break, Ehibhatiomhan was again caught out in midfield, allowing Landers to slip Earthy in behind to finish smartly.
But Swindon should not have been going in two behind as Clarke kept the visitors pegged in after a corner and crossed for an unmarked Knight-Lebel. With nobody around him, he contrived to nod it wide.
After making two changes at the break, Swindon soon halved the deficit. Three wonderful passes down the right released Murphy, who crossed into Bodin. He tried the volley and sliced it up into the air to Glatzel, who hit it first-time beyond Hegyi.
That goal opened Pandora’s Box. The crowd got right behind Swindon, and they came swinging in pursuit of the equaliser. Bodin, McGregor, and Glatzel all came close, but at the other end, Will Wright and Lewis Ward were both called upon to prevent West Ham from putting the game to bed.
Town kept going close without really testing Hegyi that severely. Eventually, they were punished as Kante shrugged off Clarke in midfield, marched forward, and slipped it to Landers to make it three.
Minutes later, Billy Kirkman’s shot from the side of the box was looped high into the air off a defender’s shin, before dropping to Glatzel to keep the hopes of a comeback alive once again.
The crowd really seemed to believe, and Glatzel continued to thrill. Clarke chipped a pass out to him on the touchline. He beat one and then another as he came inside before drilling an effort from the edge of the box that drew a save.
The opportunities persisted as Kirkman won the ball on the left and played Joe Snowdon down the line. He slid a ball into the middle that Glatzel was inches from getting to.
Glatzel couldn’t have come any closer to the hat trick as Kirkman cut the ball back to him. He took a touch on the edge and blasted one that Hegyi had to tip onto the bar.
Wright’s cross then found Ryan Delaney in the middle; his header was parried by the ‘keeper, and Glatzel could only send the rebound into the side netting.
Despite everything being chucked at the young Hammers, Swindon gave themselves too much of a job to do to take the game to penalties.
STFC starting XI: Ward, Mabete, Delaney, Clarke, Glatzel, Ehibhatiomhan, Murphy, Knight-Lebel, Bodin, McGregor, Gray.
STFC substitutes: Summers, Wright, Ball, Nichols, Snowdon, Kirkman, Foye.
WHU starting XI: Heygi, Earthy, Landers, Briggs, Kante, Golambeckis, Battrum, Ajala, Fearon, Adiele, Oyabade.
WHU substitutes: Byrne, Colau, Brown, Cummings, Sowumni, Caliste, Medine.
Attendance: 2,096 (105 away).