According to the U.S. copyright act:
A “derivative work” is a work based upon one or more pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which a work may be recast, transformed, or adapted. A work consisting of editorial revisions, annotations, elaborations, or other modifications which, as a whole, represent an original work of authorship, is a “derivative work”
The question is, of course, how far you have to remove it from the original work for it to be considered "derivative". The wikipedia article on Derivative Work is pretty good (and long). What I've always been told is that if it's clear that the new work is different from the original it's usually considered "derivative".
Another standard that's considered is "transformativeness" (again, see the wikipedia article for a more exhaustive explanation). Are you bringing a new vision or opinion of the original?
If you're incorporating elements of stock photos it's probably safer to buy them - in the long run they're not that expensive. If you're using them as a starting point and it's clear that your work is largely different from the original you are probably okay. Keep in mind that I'm not a lawyer and I haven't seen what you're trying to do so these comments are general points.