Not just with suspected terrorists but this issue arises from time to time. Examples:
A convicted pedo is released into the community.
Karla Homolka living next door.
A convicted murderer who might blow up his house along with a few others.
I remember a few years ago "Jane Doe" sue (and won) the police for not informing her and other women that there was a rapist on the loose in their area.
There is a big difference with your examples, as FF pointed out, these are examples of people who were convicted and therefore could be a possible threat to the community that they are living in.
The one example of a murderer who has been convicted of such and done his time is a tad different though. The circumstances surrounding his crime may not dictate that he is the type to blow his house up.
Pedophiles on the other hand, have a well known to re-offend. They aren't really the the one off type of offender, like a murderer.
I recall the Jane Doe case and it revolved around a single rapist, who committed his crimes by entering through open windows during a hot summer. He had committed numerous rapes before Jane Doe, in a certain area of the city and the police weighed the facts and chose not to inform the public, hoping to catch him before he was able to victimize again. They chose wrong in this case, as the threat to the area was imminent and they used the public as bait. That's why she won her case.
In the case of drug labs/grow ops and terrorism, there is a danger to the public, drug labs and grow ops can blow up and if the terror suspect is building a homemade explosive, that too can go seriously wrong. In this case, a suspected terrorist, there is more to be gained in keeping him under surveillance, gaining valuable intel on his/her means of terror (bomb, guns) if they are working in a group, a cell if you will and the extent of that group and its ties to terrorism and also what the target is. In this case, it's better to take down the whole cell, know its links and what they see as a good target. Also to track where they got their weapons, if illegal and any products used for building an explosive device, if one was made.
In the case of a drug lab or grow op, the police weigh the threat of explosion to the community and take this seriously. Once they know the link to who is behind this, they usually take it down immediately upon finding this sort of intel out, because the threat is real in this case.