I read a good article once about this topic. It might have been in the Washington Post, but I might be wrong. Anyway, they interviewed one of the TNG science advisors (Andre Bormanis?), who described how he was consulted when they wanted to introduce some new science for episodes. He would advise whether it was realistic, and would offer suggestions for how to make it more believable when it wasn't realistic. Sometimes they would take his advice, and sometimes they didn't (when it would disrupt the dramatic need for said "science").