Sam Allardyce sent on the midfielder at half-time with his side trailing 1-0, and a rejuvenated West Ham went on to win 3-1 and inflict a first defeat on new Blues boss Rafael Benitez.
Cole and Diame were both on target before another substitute, Modibo Maiga, settled the contest with a late third.
And Cole told Sky Sports: "I put that down to the gaffer's tactics.
"It was a bit defensive in the first half, but he switched it and put on some attacking players. Momo came on and changed the game for us."
Diame said: "The manager just told me to try to attack and bring something more in midfield. After the last two games I needed some rest, but after this we're confident we're going to keep going."
Cole's goal was his first in the Premier League this season and, with Andy Carroll out for up to two months, the striker is set for an extended run in the team.
He said: "I knew if I kept training hard it would come. Andy's done a great job, but he's picked up a little injury. I'm always there for back-up and will try my best when called upon."