Left foot of Hai inside a Dalet
The sofer mistakenly wrote a Hai instead of dalet, he may not make the Dalet kosher by scraping away the foot, this act is called "chok tochos" [see Mishnat Sofrim, Dalet]. The same applies by pulling the gag of the Dalet leaving the left foot way behind, this doesn't make the Dalet kosher, since this is still actualy a Hai.
Even if this Hai would be considered pasul [for any reason], it still would be a [pasul] Hai, and not a Dalet.
Therefore the sofer must pasel this dalet after scraping away the left foot from the Hai, in-order to correct the Dalet through writing כתיבה ולא חקיקה.
What is the difference between these cases?
I think in the first case, since the sofer intended this to be a Hai, it is still a hai [until the left foot is erased], but the second case nobody intended the dalet to become a Hai.