The forward scored the equaliser and set up the second goal in the Hammers' 3-1 win over their London rivals, and believes his manager's switch at half-time proved pivotal
Cole equalised for the Hammers after Juan Mata had given the visitors the lead before setting up Mohamed Diame to drill in a second.
Diame's introduction at the break proved influential and Modibo Maiga wrapped up the points with a third strike in injury time.
"I've got to put it down to the gaffer's tactics," Cole told Sky Sports. "We were a bit defensive in the first half. We switched it around and put on some attacking players who came on and did brilliantly for us."
Cole has had a somewhat sluggish start to the season but the striker is looking forward after scoring his first Premier League goal of the campaign.
"I haven't had a good time in the league of late but I just knew if I kept working hard, training hard, a goal would come and it came at the right time for us," he added. "We needed the goal and went on to win the game.
"Andy has done a great job, done brilliantly. He scored against Tottenham the other night, he was going to keep on going but he's been a bit tired and picked up an injury as well.
"I'm always there for back up and all I was trying my best when I'm called upon."
Diame also commented on his manager's tactical changes which saw the Hammers score three unanswered second-half goals.
Regarding Allardyce's team-talk, Diame said: "Just try to attack a lot and bring something more in the midfield. I think we did well today.
"For us it's a great result. We are confident, looking forward to the next game against Liverpool and we'll try to do the same."