Maybe the teacher had been told to fuck off five times that day (pretty standard at the highly successful comp where I teach) & had just had enough...
I'd probably want to be very clear exactly what my child had done to provoke that reaction before I started complaining. Quite possibly it was behaviour that would've got him decked anywhere out of school. Or maybe he did/said something completely trivial & just happened to be the last straw.
No, it's not OK for teachers to swear. Yes, we are supposed to be the adult in the situation.
But if a student uses that word to a teacher they might get a reprimand (my school - weak & unsupportive management) to a day's exclusion (tough-on-behaviour school). Big deal. Many, many teachers live with abusive behaviour & language from students, all day, every day. Without, on the whole, responding in kind - but is it so amazing if occasionally one of us snaps back? We're only effing human too you know!
An example: if easily offended, look away now - a colleague of mine was recently told 'You're a fat frigid cunt & you can stick your detention up your dyke arse'. She's 5'2. The 16 year old who said this to her is 6' odd & was jabbing her with a pencil as he spoke.
He got another detention. Which he didn't attend.