Does your application behave same way on other computers? Try several computers, several Windows versions.
Copy just a small part of your code with that particular Wininet functionality into a smaller application. Run it separately. May be the other parts of your main application somehow influence this one.
If there is no difference, and you can let me take a look at a larger piece of your code (not just CLEAR DLLS), then may be we can try find something in your source code.