As I already alluded to in my comment above, you are correct in noticing that the originally proposed method is incorrect.
Often times, for these problem unfortunately, you will need to approach by cases or generating functions. In this specific case we break into two cases:
No letter is repeated
One letter is repeated
When no letter is repeated, then we are simply working with permutations of size 3 of X,Y,Z,V, which we can see that there are $4^{\underline{3}}=4\cdot 3\cdot 2 = 24$
When one letter is repeated, notice that it will necessarily have two of one letter and one of another letter. Approach via multiplication principle:
- pick which letter is repeated (x or y) $2$ choices
- pick which is non-repeated letter (x/y or z or v) $3$ choices
- pick location of non-repeated letter (first, second or third) $3$ choices
for a total of $2\cdot 3\cdot 3=18$ arrangements of the second type.
There are then a final total of $24+18=42$ total arrangements possible.