I have a system where items are locked (with a flag in the database) when a user is vieiwing that item.
Currently the item is only unlocked when a user performs a certain action.
However, when a user leaves the page through any method, I’d like to make a call to a webservice / ashx page that will unlock the item, but not stop the page from changing.
What you are describing is not possible. The JavaScript thread/runtime lives within the scope of the loaded page, so when the page unloads the JavaScript is unloaded as well. When the asynchronous call returns and the browser has moved away from the page, the user will get a JS error.
You can make your web service/AJAX call synchronous and block until the server returns a response, but of course that means the page will wait for the response before unloading.