Sexual harassment is often attempted to be excused at parties, as such parties are seen as “a bit of fun” rather than work time. However the line between work and a “fun event” can be a fine one. If a party is held at the employer's expense, and is clearly a works party, your boss' behaviour very likely amounts to sexual harassment at work. In any case, behaviour of this sort is unacceptable, particularly if you make it clear that you do not like it, and threatening you in this way after behaving in a way that you found objectionable, would be a breach of sex discrimination laws.
If you are concerned that your boss may act on the threat and/or you now feel uncomfortable working with him because of his behaviour, speak to your union rep, if you have one. If you are not a union member, you can get advice from the Equality and Human Rights Commission, ACAS or Citizens Advice.