Computing Item-to-Item Similarity Using Cosine
Filtering users will create bias in your training data. This may be good or bad, depending on your data and goals. The best way to find out, for your specific system, is to try and test both methods, optimizing for whatever metric you choose is best.

Honestly, I think you should consider all users. Say you have a system for recommending movies. In this system, i1 represents a children's movie, that is rated by users u1 through u5, with u5 being a parent and u1, u2, u3 and u4 children. Similarly, i2 represents a terror movie, that is rated by users u5 through u9, all adults. In such a system, u5 being the only common ground between i1 and i2, if this user rated both positively and you only consider them, then you will have a high similarity between the items; but if you consider all users that rated either movie, you will have a very low similarity.

Or in other words, I think intuitively it's best to consider a missing rating as a false/negative rating. Excluding terms where both ratings are zero makes no difference in the cosine similarity anyway. But again, you should run and test it.