In your event handler function ui.tab is an anchor element. You can retrieve its hash value like this:
$("#tabs > ul").tabs();
$("#tabs > ul").bind("tabsshow", function(event, ui) {
window.location.hash = ui.tab.hash;
})
Does this work for you?