I believe this scene shows a fallacy which is not uncommon in action movies - the idea that the strength and fortitude will somehow always overcome adversity.
Blofeld tells Bond:
"When the needle hits the point right here in the brain, you can't
recognize no one! You will not remember her because she will be
another face on your grave."
Now, there are a few potential explanations of what happened next.
Blofeld made a mistake, or Bond got lucky
It's possible Blofeld missed the spot he was aiming for, or correctly targeted it and Bond was lucky and avoided the worst of the damage. This may be possible, but feels unlikely to be.
Bond adjusts (and saves) himself
Bond does noticeably twitch as the drill is coming towards him (understandably so). It's possible he changes the angle the drill is impacting him ever so slightly, and thus avoids it hitting him in the exact spot it needed to for Blofeld's plan to work. Again, this is possible, but feels a little unlikely to me.
Bond's strength and desire to keep his memories overcome the pain
This is the least logical of the options, and yet I also think it's the most likely. We often see in action films our heroes overcoming things they really shouldn't be able to overcome. As the drill was going in, he looked into Madeleine's eyes and focused on remembering her - and by doing so was able to find the strength to overcome what was happening to him.
I believe this is the most likely option. Of course, another way to phrase this might be to simply call it a movie mistake. After all, you can't overcome brain damage by a brain drill via mental fortitude. But given the lack of other explanation, it seems the macho man Bond theory is the best one (in my view at least).
It is worth considering, as a side note, that the entire brain drill scene isn't exactly scientifically accurate. To quote from Dr. Cusimano:
"Aiming to erase Bond's memory of faces, the villain correctly
identified the lateral fusiform gyrus as an area of the brain
responsible for recognizing faces...But in practice, the drill was
placed in the wrong area, where it likely would have triggered a
stroke or massive hemorrhage."
Given the scientific inaccuracy of the scene, I'm hesitant to read too much into Blofeld's mistakes, or Bond's adjustments as theories, and instead I think his strength and desire are the most likely.
(Of course, a small part of the Internet has argued that everything that happened after the brain drill entered his skull was fantasy. I certainly don't believe that, but will leave it here for a reading!)