Yes, it will work.
Whether or not the offspring is the same Pokemon as the non-Ditto parent you are using has no bearing on your chances of getting a shiny.
Although they are technically different species, in breeding mechanics they count simply as a male/female equivalent of the Pokemon you are breeding. It's not like you have less of a chance of getting a male shiny Charmander than a female if you used a Charizard to breed, for example.
Source: I've been breeding Pokemon for nine years.