there are two modern interperetations of this phrase - the original, which is - someone or something who wins or succeeds against the odds and expectations, and a second meaning - somone who is shown to be keeping a secret. I believe it originates from horse racing years ago, when it was hard to distinguish one horse from another, especially 'dark horses' with no distinguishing marks, which made it easy to swap one for another and win against the odds.
Would the Sherlock Holmes story "Silver Blaze" count as an example? The horse (which has a white flash) is entered for the race despite having been dyed black.
Thought this term originated in horse racing and was given to a horse which had no form but showed promise but nothing was known of it outside the stable it raced from.