You need to check the number of elements found, as jQuery returns an empty collection in the event of no elements being found (which evaluates to a truthy value in the if statement):
if ( !$(".first.last").length )
I'd suggest testing against 0 explicitly, rather than relying on a falsey value, though:
if ( $(".first.last").length === 0 )