On for the last 12 minutes, the striker won a penalty in injury time as he was felled by Lucas Neill in the box.
JD picked himself up, placed the ball down on the spot and struck firmly towards the bottom corner only for Green to guess the right way and save diving to his left.
A game that had once again swung this way and that boiled up to another thrilling finale as Paul Robinson denied Scott Parker and Dean Ashton at full stretch, Jermain Jenas cleared off the line and then Defoe's late, late penalty all took place inside the last seven minutes.
Juande Ramos made one change to the team that began the rout of Wigan two weeks ago, with Gareth Bale restored to the side in place of Lee Young-Pyo. It came close to being an instant continuation of the form shown against the Latics, with Aaron Lennon having a goal ruled out for offside in under five minutes.
Jermaine Jenas took aim and fired in from outside the area, Robert Green parried away and Lennon slotted, but it was an early flag and there were no premature celebrations. Berbatov then claimed penalty when he appeared to be tripped by Matthew Upson, with referee Mr Riley leaving it a second before motioning his arms to 'play on' position.
It was a positive beginning, the team were straight on the offensive and, given the line-up, it was probably the best approach. There were clearly no negative thoughts when it came to team selection. A Jenas free-kick caused a degree of confusion and it took the shins of George McCartney to deny Pascal Chimbdonda in front of goal.
Out of nothing West Ham got the lead in the 20th minute. Younes Kaboul looked set to start a move from the back, but was closed down by Louis Boa Morte and, via a neat low centre from Nolberto Solano, Carlton Cole was able to tap into an empty net. It was a costly mistake and the home side had an advantage their performance up to this point did not merit.
After this it could have been two when Cole and Boa Morte carved us open down the right and Paul Robinson produced an excellent block from the latter. The error appeared to create some defensive uncertainty and a little of the zest went out of the attacking sorties.
Mistakes crept into the play of both teams as the clock ticked towards the break, although neither goalkeeper was particularly active until a bemusing incident on 40 minutes. A floated ball over the top caught out the Hammers' last line and Keane was through and in the act of by-passing Robert Green was felled by the goalkeeper and we waited for Mr Riley to point to the spot and in all probability show a red card to Green.
The official did neither...
Steed Malbranque had a gift of a chance to level shortly after half-time following a surging run from Jenas that had the West Ham rearguard peeling away. He prodded through to the Frenchman, who hit first time and wide - his blushed spared by the linesman's flag. Berbatov should then have supplied the advancing and unmarked Keane and Lennon, but opted to go alone and was foiled.
Darren Bent was introduced for Kaboul, leading to a reshuffle that resulted in Dawson, Zokora and Chimbonda forming a three-man defence, with Lennon and Bale patrolling the flanks and Malbranque moving in-field.
It took a little while for people to adjust to their new responsibilities, but Lennon was quickly zipped to the attacking end of his watch and provided a low centre that if Keane had struck first time we would probably have been celebrating parity.
We did not have to have wait much longer for that particular joy - the 67th minute and a set piece executed by Jenas was latched onto by Michael Dawson and his flick of the head was enough to deceive the on-rushing Green and the ball landed in the net at the end occupied by the Spurs travelling thousands.
Malbranque was soon stinging the hands of Green with a piledriver after a lung-busting dash by Bale down the left - both elements of the move deserved greater reward. Cole then drilled wide and drew gasps at the other end.
As the match reached a climax, Robinson produced identical saves to deny Scott Parker and then substitute Dean Ashton before Jenas stooped to head clear as Upson's header angled towards the far corner.
It all led to what should have been Defoe's moment and three points - but Green had the final word and it was honours even.
Jermain Defoe was denied a dramatic late winner at his former club by Robert Green as Sunday's derby ended in a draw at Upton Park.