My wife always corrects me when I say ихний or ихних instead of их. However, I've seen these pronouns in classical literature many times (Chekhov, Tolstoy, Dostoevsky).
Which form is correct in speaking and writing?
That's the question of norm and usage. Russian language is generally quite strict when it comes to enforcing the norm. Even when the usage rendered the norm completely obsolete, the norm is still perceived as such. A good example is the word кофе: if you use it in neuter gender, there's a chance someone corrects you, even though the neuter gender is marked as acceptable in the dictionaries.
It's pretty much this with the word ихний. It is definitely used, and not only by less-educated people. It's just that it's not in the norm.
The case where ихний is logical from the language point of view is when there is an ellipsis. Consider these sentences:
"Whose books are those?" — "Theirs."
Чьи это книги? — Их.
Now, in colloquial speech, ихние can be used instead of их with an additional advantage of having the number and case information embedded, just like мои, твои, наши, ваши have. In such case, even a norm-abiding speaker might say ихний.
In most other cases, when the noun is present as normal (их книги), there is no need for any norm-bending.
I have the following impression:
The word "их" is correct form (norm). But in everyday speech one may want to insert jokes, special features. Then he will use "ихние" form. One can understand that this is incorrect wording, but use it anyway. Such behavior is called "выпендриваться" and usually is not accepted well.
The same pair are "звонИт" и "звОнит". The first form (with the stress on the second syllable) is literature norm, but second form sometime is used (and the second is formally incorrect).