The key in this case is word order.
The "No sooner" part of the "No sooner...than..." construct is always at the beginning of the sentence. However, the word "hardly" is more flexible with regards to its order in the sentence. In American English usage, the word order for that example sentence would not be "Hardly had she spoken...," but more likely, "She had hardly spoken...."
In the example you cite, the word "Hardly" is put at the beginning of the sentence, in the same spirit as "No sooner." For this reason, using "than" instead of "when" in this case does not seem unnatural; "hardly" sits in for "no sooner." However, if you were to try to use "than" with "hardly" when it's not at the beginning, e.g., "She had hardly spoken than she regretted it," it would sound wrong, at least to an American speaker.
All of that said, let these two examples serve as ones to imitate: (1) "No sooner had she spoken than she regretted it bitterly." (2) "She had hardly spoken when she realized she shouldn't have said anything."