Unfortunately, you have jump thru a few hoops. Just changing your link's href tag won't do anything:
$("link").get(0).href = "newicon.ico";
You also have to remove the <link> tag from the dom and re-add it:
function setFavIcon( src )
{
var link = $('link').get(0);
var linkparent = link.parentNode;
link.href = src;
$(link).remove();
$(linkparent).append(link);
}