Well, you can strip off anything before !player by using $left() and $pos(). Use $pos() to get the position of !player and use $left() to remove everything before the value $pos() returns. Then, strip off quotation marks and tokenize the results. This will once again make $2 the correct value.
I can't test this and don't make much use of $pos(), so it likely has errors, but this is the basic idea:
on *:text:*!player*:#: {
var %pos = $pos($1-,!player)
var %text = $left($1-,- $+ %pos)
tokenize 32 %text
if ($sock(!player)) .sockclose !player
set %heraldchan $chan
set %heraldnick $nick
set %heraldplayer $2
sockopen !player herald.uthgard-server.net 80
}