Will Dixon is a writer for such shows as The Outer Limits and Psi Factor, and he has a rather good blog post about the essence of mystery writing.
He explores the distinction between open and closed mysteries, before using Joss Whedon’s style as a good example of an effective structure. It’s worth a read.