The gemara suggest that R. Yossi Ben Meshulam agrees with Rav (who paskens like R. Yehuda) that דבר שאינו מתכוין is forbidden. How then does he permit the cutting of the black parts of the hairs of the פרה אדומה leaving behind only the red parts, although he isn't intending to be גוזז but to fix the parah a'duma, it should still be a violation? The gemara implies, and Rashi explains explicitly that since his intent when he is cutting the black parts of the hair is to fix the cow rather than take the hairs, it would be considered a דבר שאינו מתכוין. Tosafos points out that this seems to be a very strange application of דבר שאינו מתכוין. Normally a דבר שאינו מתכוין is where one doesn't even intend to do the ma'aseh issur, but where one intends to do the act of issur just that he is doing it for a different purpose than it is normally done for, it would be considered a מלאכה שאינה צריכה לגופה (which is a special p'tur in hilchos shabbos due to מלאכת מחשבת- it doesn't apply to other areas of halacha and even on shabbos is exempt from punishment but forbidden). In this case where the person is cutting the hairs of the parah a'duma intending to do the act of cutting, it would be similar to a standard מלאכה שא"צ לגופה, but shouldn't qualify as a דבר שאינו מתכוין? Tosafos asks this question in very few words -
דאין זה כשאר לשון "אין מתכוין" בעלמא דכיון דבכוונה גוזז במספרים. Why does the gemara consider this to be a davar sh'eino miskavein?
It seems to me that by certain מלאכות the purpose of the act is so integral to the melacha, that when the act is done for a different purpose it is tantamount to not intending to do the act at all. The prohibition of גוזז on kodshim is that it is forbidden to do things that enable one to take the products of the animal (whether it is the wool, the work in the field or the milk), while it is still alive. Although Tosafos (d.h. sa'ar) explains that the issur is a ma'aseh issur of cutting the wool, unlike the issur of the milk which is an issur on the product, the nature of the issur to cut the wool is because normally one would do this act to obtain the product. When one is גוזז but has no interest in the wool, it undermines the act of גוזז to the point where we consider him to not be intending for גוזז at all. Therefore, when he cuts the blackened parts of the hairs for the purpose of fixing the parah aduma, not for the purpose of using the hairs, it is considered as if he isn't intending to do the act of issur.