TicTacToe State Space Choose Calculation I understand there are numerous questions around the internet about the state space of tic-tac-toe but I have a feeling they've usually got it wrong. Alternatively, perhaps it is I who have it wrong. Which is what leads me to my question.
Common Over Estimates:
Over Estimate One:
First some common answers to the number of possible states in Tic-Tac-Toe:
$9! = 362880$ 
This is one solution, which is overstates the upper-bound by the most I have seen, as it includes states such as:
x1|o2|
--------
  |  |
--------
  |  |  

as well as:
x2|o1|
--------
  |  |
--------
  |  |  

and all the other sequences of combinations possible. (Thank you to Exodus5 for pointing out the error.)
Over Estimate Two:
Another common answer that is better, common, but still over-estimating is:
$3^9 = 19683$
Which is better. Now we only count the following board once...
x|x|x
-----
x|x|x
-----
x|x|x

but I've still never heard of any type of one-player tic-tac-toe and it seems boring.
These guys claim they've got the answer but they are discussing games not state-spaces. That is the progression of the N-moves in a game is also taken into account.
The Power of Choose:
After sitting down and thinking for awhile I came up with a formula that does a more precise job at estimating the state space of tic-tac-toe and it is quite simple, but still not 100% as it still overestimates. 
$9 \choose 1$ * $8 \choose 0$ +
$9 \choose 1$ * $8 \choose 1$ +
$9 \choose 2$ * $7 \choose 1$ +
$9 \choose 2$ * $7 \choose 2$ +
$9 \choose 3$ * $6 \choose 2$ +
$9 \choose 3$ * $6 \choose 3$ +
$9 \choose 4$ * $5 \choose 3$ +
$9 \choose 4$ * $5 \choose 4$ +
$9 \choose 5$ * $4 \choose 4$ = 9+72+252+756+1260+1680+1260+630+127 = 6046
Edit: The final term above I had $4 \choose 5$ but the correct value is $4 \choose 4$ which yields the missing 1 from Immanuel's solution.
Essentially each term of $9 \choose X$ is placing the X's on the board, then the $K \choose L$ is the O's choosing the appropriate number of places from the remaining open spaces on the board. Each term being added is the number of states being generated at each turn. So for turn 1 we have 9 states, for turn 2, 72 states and so on.
The main point here is 6046 is far fewer than the other estimations, the use of Choose seems rather elegant considering its simplicity and the accuracy we are able to achieve, and lastly I like how each term being added correlates to each turn.
I recognize that it is not perfect, as I am ignoring some win conditions, i.e. this board is also counted:
x|x|x
-----
x|o|o
-----
x|o|o

Which isn't a legitimate board but still 6045 is less than $1/3$ of the commonly stated $3^9$ and isn't the equation rather beautiful?
The Question:
The question is, does this application of choose accurately represent how X's and O's can alternatively be placed on a 3x3 grid? Have I missed anything?
Bonus question: Any insights on how to estimate the number of illegitimate boards during moves 6, 7, 8, and 9? Note: With 5 or fewer moves, all boards generated are legitimate.
The goal is not to have a computer brute force the thinking for us, but to gain a deeper understanding of the distribution of win conditions. Also to make sure I didn't make any mistakes.
 A: Which states do you have that are illegal?
Note that the positions you have counted are either legal, or one move past legal as if the loser was allowed to make one more move after losing. So we need to count the ways that the loser has too many squares.
To count the way X's have a line, but O's and X's have the same number of squares (two cases: 3 of each or 4 of each), we pick the line (8 ways) and then fill the rest of the squares to get $8\times\left(\binom{6}{3} + 2\binom{6}{4}\right)=400$.  The $\binom{6}{3}$ is choosing the locations of the O's in the 3 case. If we have 4 of each, then there are $\binom{6}{4}$ ways to place the O's and 2 places left to put the last X.
To count the ways that O's have a line, but there are more X's than O's, we get $8\times\left(\binom{6}{4} + \binom{6}{5}\right)=168$. $\binom{6}{4}$ is the number of ways to have 4 X's and 3 O's. $\binom{6}{5}$ is the case where we have 5 X's and 4 O's. 
Subtracting these from your 6046 gets 5,478, which matches the computer.
A: There are very few, so an exhaustive computer search is quite easy.  There are 5,478 total positions, of which 958 are terminal, either because the board is full or because one of the players has won.
This assumes that X always plays first.  If O is allowed to start, the set of positions is larger, but still less than twice as large.
This counts board positions, not play sequences.  For example, if X plays in space 1, then O plays in space 2, then X plays in space 3, that is considered the same as if X plays in space 3, then O plays in space 2, then X plays in space 1, and it is not counted separately; nor is any subsequent position counted again.
It does not take rotations or reflections of the board into account; rotated or reflected boards are considered different positions. This would be quite easy to fix, if desired.
Source code is here. The game_over subroutine detects whether one of the players has three in a row; the next_moves subroutine calculates the moves available from a position, first using game_over to detect if one of the players has won; if so it reports that there are no legal moves and therefore no following positions.
