Charlaine Harris explains this much better in the books but, Sam is a shape shifter and can transform into anything at will, but it has to be something recent in his awareness. If he sees the fly, then he can immediately transform into it. He usually has his dog close by him, so that he can quickly transform into a copy of it. I am not sure if Sam again saw another fly in this episode just before he transformed, or whether he was still holding a likeness of it in his mind and transformed from that - but he probably held off doing it because he didn't want to freak everyone out so he waited for a distraction.Originally Posted by MisterSSS;3677554;
Also, he may not have wanted to leave Andy and Jason helpless by deserting them. No one but Sookie and other supes knows that Sam is a shapeshifter.
Andy knows/thinks Sam is a "nudist" from the first season of TB. (Andy and his cousin Terry (bartender/cook) were fishing when they caught Sam running nude at the full moon just before he transformed. But, neither saw him actually transform). So that explains why Andy just raised his eyebrows when he saw Sam nude outside his door in previous episode.
I can't remember when Andy finds out about Sam in the books........ but Alan can make it happen anytime.