The visitors were the better side and kept West Ham goalkeeper Jussi Jaaskelainen busy throughout the match, particularly in the first half.
West Ham did improve after the break but Pennant curled in a delightful free-kick with eight minutes to play for the visitors.
West Ham manager Sam Allardyce made 11 changes to the side that beat Cheltenham Town in the League Cup on Tuesday, recalling key men Jaaskelainen, Kevin Nolan and Matt Jarvis among others.
Stoke were also victorious during the week as a Kenwyne Jones hat-trick inspired them to a 3-1 win over Walsall, and the forward kept his place in the side, while winger Matthew Etherington was included against his former club.
Jones almost continued his scoring form inside the first 10 minutes as he latched on to a through ball from Charlie Adam, but after holding off Winston Reid with a typical showing of strength, he could only fire over.
West Ham were slow out of the blocks and although they gradually grew into the game, their final ball let them down on several occasions.
Stoke – who had eight shots on goal in the first half - continued to threaten and Jaaskelainen made several good saves, initially turning Marc Wilson's swerving volley wide.
The Finland international then kept out a close-range header from Jonathan Walters, who was incorrectly judged to be offside.
West Ham's first significant chance of the match came in the 35th minute, but Modibo Maiga could not direct his harder on target after a good Jarvis cross, as both sides went to the break without a goal.
Stoke picked up where they left off in the second half, and nearly took the lead in fortuitous circumstances.
Adam's in-swinging corner hit an unsuspecting Ryan Shawcross on the thigh but went wide, while Allardyce looked to substitute Ravel Morrison to spark his side into life.
Reid had a chance at the other end for West Ham, but volleyed over after a corner was improperly cleared, before Stoke took a deserving lead in the 82nd minute.
Pennant – who had been introduced just six minutes earlier for Etherington – curled the set-piece around the wall, giving Jaaskelainen no chance.
And although West Ham threw bodies forward late in a bid to get an equaliser, Pennant's first goal since May 2011 was enough to give Stoke all three points.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.