The hosts seemed destined to record a third successive clean sheet in the Premier League as the game headed towards a goalless draw, only for referee Jonathan Moss to penalise Mohamed Diame for shoving Glenn Whelan in the 82nd minute.
Pennant stepped up and struck a stunning right-foot curler over the wall to earn the Potters back-to-back wins in the Premier League for only the second time this year.
It was his first goal in 63 games, which stretched back over two years, as City ended the Hammers’ unbeaten start to the season.
Visiting Stoke were the more dominant side, but failed to make their possession pay.
Jussi Jaaskelainen repelled a point-blank shot from Jonathan Walters in the first period after parrying out Marc Wilson’s long-range effort, while Matt Jarvis’ right-wing cross was headed just wide of goal by Modibo Maiga.
There was very little between the sides in the second half and one moment of magic was enough for the visitors to earn their second league win of the season.
The return of Andy Carroll, out with a heel injury, cannot come soon enough and the England striker is expected to be available for Southampton on September 15.
This performance may convince Sam Allardyce that reinforcements are needed before the transfer window closes on Monday, while in contrast Hughes must be pleased with the early progress he is making at Stoke.
The visitors’ superiority was evident from the start as they moved the ball forward purposefully.
Kenwyne Jones ran almost half the pitch as his strength took him past Kevin Nolan and, when James Collins arrived to provide pressure, he skied his shot into the stands from 15 yards out.
Stoke began to ride their luck a bit as Diame and Joey O’Brien caused problems either side of the area, but they went desperately close to taking the lead in the 23rd minute.
A dipping long-range shot from Wilson deceived Jaaskelainen, who could only parry it to the side. Walters arrived to bury the follow-up but the West Ham keeper reacted just in time.
Stoke were dominating the game but needed to make more of their chances as Steven N’Zonzi thumped a shot into the advertising boards.
It was West Ham who proved wasteful with 10 minutes of the first half remaining after Maiga directed a perfect cross from Jarvis wide.
The match desperately needed a goal, but as the second half progressed it seemed farther away than ever.
Winston Reid landed heavily on his left shoulder following an aerial duel with Jones but, despite being in obvious pain, he continued playing after a brief spell on the sidelines.
West Ham replaced the ineffective Stewart Downing with Ravel Morrison with almost half an hour left, but a burst of pace from Jarvis proved he was still his side’s most dangerous player.
Finally Stoke’s defence was having to work as crosses began to arrive into their box with increasing regularity, Reid going close on one occasion.
Guy Demel squared the ball across the face of goal but there were no team-mates in place to take advantage.
Then Stoke struck the telling blow with both substitutes involved – Whelan winning the free-kick that was beautifully buried by Pennant.