We got to see a different side of Niles here. We have grown accustomed to his subtle jabs at his peers but here we saw his mockery transcend to a different level by his refusal to cooperate with his father's lower class girlfriend. Things got worse for him when he walked in on Martin and said girlfriend doing the no no.
What is great about Frasier is how intelligently they handle even the worse predicaments. Walking in on sex is a common plot device used on sitcoms, but instead of potty humor Frasier opts for more subtle and clever gaffes.