Question is: Why is custom Error handling not working for non-existing paths/directories?
Updated with fixed code (thanks to everyone for you input):
I can't find the source material for this but I believe the problem lies in the fact it is handling custom error pages and not paths.
You investigation suggests you came across this, inasmuch as:
www.mysite.com/nonexistingpath/nonexistingpage.aspx
This ought to hit the correct error page. The following won't:
www.mysite.com/nonexistingpath/
This kind of reiterates you already answering your own question, but I'll see if I can find the reference material. Ultimately, it isn't a page request, so there is no ISAPI handling through appropriate handlers.