Yes, it is appropriate to use humour in your cover letter. The best way to add humour to your cover letter is to:
not overdo it (one joke or pun should suffice as an attention grabber)
stay professional (avoid crass jokes or foul language)
keep it relevant to the target position