Confusing.
I don't think that action=newpost thing is used anywhere else on the board, so I wasn't really familiar with it... I think I understand the problem though... do you just want the link to go to the post that's it's notifying you about? That's what I would have done... none of this "first post after your last visit" stuff...
Edit before posting
: now that I check out this newpost thing, it seems that as long as your "last visit" time was before A and B posted, and you didn't visit the thread after A posted, you should go to A's post, not B's as you said... still confusing...