You've come up with this wonderful adventure. The bad guy is all planned, the setting is described, his minions are all rolled...and then your players go off in a totally different direction.
It happens and as a GM you have to be prepared. When I was GM for our college Star Wars adventure my players would always veer in a weird direction. The key is to get them back on track without pushing too hard or look like you are leading them by the nose.
1) Have a back up plan. Have some NPCs or monsters rolled up, just in case. It never hurts to have this sort of stuff anyway for random encounters. Think on what the players did last time and make sure any tangents are covered.
2) Saying that, even covering the would be tangents may not be enough. There were adventures my players went off in a very weird direction. In this case you have to be light on your feet. Don't get frustrated, just go with the flow. and as your players go along on their tangent you need to think on how to get them back on track. Did they go after some peon you didn't plan on. Let them go but throw in a clue that leads them back to the main adventure. That may not be enough, but if you keep doing it, (say they keep going after peons but not the direction you want to go, yet keep leaving clues to your main adventure) eventually they'll get back on track.
3) Go with the flow. If the players want to go horse racing instead of fighting bad guys, let them. You're all there to have fun and one night off track won't kill your campaign.