Although small parts may initially adhere where there is paint, they will inevitably fall of after a short time. With regards to what you do to get around this, it really depends on how easy the area will be to clean before fitting "little piece".
In a few circumstances masking may be preferrable, but in my experience it is easier to paint the part then remove / scratch away anything that is going to get in the way of gluing additional parts on. Needle files are very useful for clearing holes out, as landing gear may typicaly be fitted into.