Offensive or highly unusual expressions are dangerous.They risk taking the reader out of the story and make him react negatively to the author instead of following the story. You need to justify your expressions to the reader.
This means two things: First, you must convince the reader that you had good reason to write it. Second, you must convince the reader that the character had sufficient reason to say it. Second criteria is easier since the fictional character was not paid to please the reader and is not even required to be aware of the reader. Authors by contrast are expected to remember their audience and not offend it. See Mark Baker's answer for more on that.
So what is a good reason to write something like that?
It could directly advance the story. A character says something offensive and it directly causes something that advances the story. If another character gets pissed off at the offensive language and the offender gets in trouble, the reader has no need to get offended themselves. And if the development is funny or exciting the reader will accept the offensive language as price of admission.
It could establish character personality, mental state or relationship to other characters. Often all at once. Your example could be used to show that the character: 1. Has a juvenile sense of humor and thinks saying such things makes him cool, 2. Is at the moment trying to make himself look cooler probably because he feels insecure, or 3. Is talking to someone he wants to impress with his coolness.
If the reader knows you are using the expression as a part of such author admissible goal it is fine. Usually this means that you need to straight out and on the spot tell the reader that is what you are doing. If the reader has to guess, you will get mail.
Even if the context makes it easy for the reader to guess correctly your intent they will not see it as a good enough reason to offend them unless you add something that makes the intent clear. Essentially making it explicit by adding narrator or in character explanation tells the reader that you did it for a reason and it will be important later.
If it won't come important later, do not do it.
Inoffensive oddities like the biker speaking with perfect grammar and Sunday school vocabulary with occasional quotes of Shakespeare have a lower standard of importance. You still need to establish the reason before the reader has time to guess.
What is sufficient reason for the character to say it
This is typically the easier part since we all are constantly struggling with the issue of what language is appropriate to use. There are some differences to real life, though. Fictional characters are not really expected to be as random as real people. This basically means that you have to clearly establish the reason the character says what he says. He can't say it "just because" unless you specifically establish he is a character who says things "just because".
The only real issue is that you need to remember to tell the reason. If your character uses offensive language to impress his comrades with his coolness, the scene where he does that needs to tell that to the reader. If that explanation seems excessive or out of place that probably means that the character does not have sufficient reason to use such language.
Odd language is easier since after the first explanation it works as its own reminder. So if you use offensive language, you should make it memorable by using hyperbole or some other method.
Probably unnecessary, but I want to be clear that the above is a collection of my personal thoughts on the matter and anyone who thinks of it as advice they should follow or in any way authoritative is wrong. Its only purpose and appropriate use is as food for your own thoughts and opinions. This is not really proper for a SE answer, but to be honest I almost always aim for answers that are potentially useful rather than correct. People only ask or answer questions if they are interested in the topic and want to know what other people think. Or so I tell myself, anyway.