Ok, I've got it working with the last message, however, this won't fix your issue as the next entry in the ticket is then a response so its stored in a different table. I'm going to work on this later today and see if maybe I can do some sort of join and then list the last entry there instead.
Ok, I've got it updated now so that it checks which is newest, response or message and then lists that as the tooltip. See my tutorial page for the new code.
(http://sudobash.net/hacks-a-mods/osticket/4941-ostickets-g-javascript-tooltip-ticket-preview.html)