This is purely anecdotal but my fiend has used heroin
after several days of no use at all and had a urine test the same day and to my complete and utter surprise it was negative. I suspect the reason for this was it didn't have enough time to get in to the urine in sufficient quantity to reach the threshold or that the test specifically looks for morphine
and that not enough time had passed for enough of the heroin to be metabolised to morphine and enter the urine.
I don't believe it's instant but certainly fairly quickly and may depend on the test and what it can detect. I am not entirely sure how they work but I believe they use something that binds to the drug
it's looking for and creates that second line.
Watering down the urine could make the sample unacceptable for two reasons; the temperature isn't in the acceptable range (it does vary a couple of degrees on either side of body temperature) or if the temperature is acceptable (or not measured which can be the case if it's not an instant test) the creatine levels could be too low indicating dilution. With the urine tests I have seen recently they don't appear to measure creatine but they do have a temperature indicator and are instant tests. Creatine levels can also be lowered if someone drinks a lot of water in an attempt to "flush it out their system", this is a complete myth and the only thing is does is dilute the urine 'in vivo' instead of direct 'in vitro' dilution . This may
work since the urine is diluted thus the drug(s) present fall below the detection threshold but it does not flush the drug out your system, half life is half life and no amount of water will flush it out. The time it takes to leave your system depends on metabolic rate and other things such as liver function and general health but it will still fall within the elimination half life range.