Jkyle1980's solution is correct, and much less verbose than what follows.
You can distinguish among 3**N cases in N weighings.
There are 54 possible cases in this puzzle [one of 27 coins is heavy or light].
So three weighings [27 cases] won't do it, but four [81 cases] can.Spoiler for Here's a very slightly modified approach
So, like I said, 4 right?