Old thread, you may not need an answer any more, but I thought I would throw one out there, anyway, just in case.
I think your problem is with the line:
Dim insUserPrincipal As New UserPrincipal(insPrincipalContext)
Because inUserPrincipal is passed to the QueryFilter, the query returns objects of type UserPrincipal.
From the MSDN documentation:
"The type of the derived class object that is passed to this property determines the type of object that is queried"
And of course, you can't cast a base class to a descendant type. Try:
Dim insUserPrincipal As New MyExtendedUserPrincipal(insPrincipalContext)
You may also have to implement your own AdvancedSearchFilter method in MyExtendedUserPrincipal... look
here for a good example of inheriting from UserPrincipal.
HTH, or at least clears up an old problem,
James