That works.

The way I heard the riddle is more math oriented.
The first guy can see all the hats.
His guess is 50/50 no matter what.
He sees nine hats in front of him, so there will be an odd number of ONE color, and an even number (or zero) of the other color.
He says the color he sees an odd number of.
The next person sees 8 hats.
If he sees an odd number of the color said by the first guy, then he has the other color.

Let's say the first person said black.
The next person sees an odd number of black hats, so he says white and lives.
The next person sees an even number of black hats, so he says black and lives.
Now everyone knows a black hat has been removed, so there are now an even number of black hats.

Every time someone hears a black hat removed from the line, then the number remaining goes back and forth between odd/even.
They know if there is an odd/even number of black hats left at any given time, and they know how many black hats they see in front of them.
Using this info, all nine will live.
Only the first person is a 50/50 shot.