Your strategy is correct, but your solution is not.
Let $x_i$, $1 \leq i \leq 12$, be the number of elements from the $i$th class. Since we want to select a total of $12$ elements, with at most $2$ from any class, we want to find the number of solutions of the equation
$$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} = 12 \tag{1}$$
subject to the constraints that $x_i \leq 2, 1 \leq i \leq 12$.
If we initially ignore those constraints, a particular solution of equation 1 in the nonnegative integers corresponds to the placement of $12 - 1 = 11$ addition signs in a row of $12$ ones. For instance,
$$1 + + 1 1 1 + 1 + + + 1 1 + 1 + 1 1 + + 1 1 +$$
corresponds to the solution $x_1 = 1, x_2 = 0, x_3 = 3, x_4 = 1, x_5 = x_6 = 0, x_7 = 2, x_8 = 1, x_9 = 2$, $x_{10} = 0, x_{11} = 2, x_{12} = 0$. The number of solutions of equation 1 in the nonnegative integers is the number of ways we can place $12 - 1 = 11$ addition signs in a row of $12$ ones, which is
$$\binom{12 + 12 - 1}{12 - 1} = \binom{23}{11}$$
since we must choose which $12 - 1 = 11$ of the $12 + 12 - 1 = 23$ positions required for $12$ ones and $11$ addition signs will be filled with addition signs.
From these, we must subtract those solutions which violate one or more of the constraints. Observe that at most four constraints can be violated since $5 \cdot 3 = 15 > 12$.
Suppose $x_1 > 2$. Then $x_1' = x_1 - 3$ is a nonnegative integer. Substituting $x_1' + 3$ for $x_1$ in equation 1 yields
\begin{align*}
x_1' + 3 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 12\\
x_1' + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 9 \tag{2}
\end{align*}
Equation 2 is an equation in the nonnegative integers with
$$\binom{9 + 12 - 1}{12 - 1} = \binom{20}{11}$$
solutions.
By symmetry, there are the same number of solutions which violate the restriction that $x_i \leq 2$ for each of the $12$ variables. Hence, we need to subtract
$$\binom{12}{1}\binom{20}{11}$$
from the number of solutions of equation 1.
If we do so, we will have subtracted too much since we will have subtracted each solution in which two constraints are violated twice, once for each way we could have designated one of the variables as the variable which exceeded $2$. We only want to subtract such cases once, so we need to add them to the total.
Suppose $x_1 > 2$ and $x_2 > 2$. Then both $x_1' = x_1 - 3$ and $x_2' = x_2 - 3$ are nonnegative integers. Substituting $x_1' + 3$ for $x_1$ and $x_2' + 3$ for $x_2$ in equation 1 yields
\begin{align*}
x_1' + 3 + x_2' + 3 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 12\\
x_1' + x_2' + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 6 \tag{3}
\end{align*}
Equation 3 is an equation in the nonnegative integers with
$$\binom{6 + 12 - 1}{12 - 1} = \binom{17}{11}$$
solutions.
By symmetry, there are the same number of solutions for each of the $\binom{12}{2}$ ways we could violate two of the restrictions. Hence, we need to add
$$\binom{12}{2}\binom{17}{11}$$
to the total.
However, adding these cases to the total adds too much. We have subtracted each case which violates three of the restrictions three times, once for each of the three ways we could have designated one of those three variables as the one which violates the restriction, and added them three times, once for each of the $\binom{3}{2}$ ways we could have designated two of those three variables as the ones which violate the restrictions. Therefore, we still need to subtract those cases which violate three of the restrictions.
Suppose $x_1 > 2$, $x_2 > 2$, and $x_3 > 2$. Then $x_1' = x_1 - 3$, $x_2' = x_2 - 3$, and $x_3' = x_3 - 3$ are nonnegative integers. Substituting $x_1' + 3$ for $x_1$, $x_2' + 3$ for $x_2$, and $x_3' + 3$ for $x_3$ in equation 1 yields
\begin{align*}
x_1' + 3 + x_2' + 3 + x_3' + 3 + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 12\\
x_1' + x_2' + x_3' + x_4 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 3 \tag{4}
\end{align*}
Equation 4 is an equation in the nonnegative integers with
$$\binom{3 + 12 - 1}{12 - 1} = \binom{14}{11}$$
solutions.
By symmetry, there are the same number of solutions for each of the $\binom{12}{3}$ ways we could violate three of the restrictions. Hence, we need to add
$$\binom{12}{3}\binom{14}{11}$$
to the total.
Now, we have subtracted too much. We subtracted each case in which four of the restrictions are violated four times, once for each of the four ways we could have designated one of the four variables which violated the restrictions as the one which violated the restriction; then added them six times, once for each of the $\binom{4}{2}$ ways we could have designated two of the four variables which violated the restrictions as the two which violated the restrictions; then subtracted them four times, once for each of the $\binom{4}{3}$ ways we could have designated three of the four variables which violated the restrictions as the three which violated the restrictions. Therefore, we have subtracted those cases in which four of the restrictions are violated $4 - 6 + 4 = 2$ times. We only want to subtract them once, so we must add them to the total.
Suppose $x_1 > 2$, $x_2 > 2$, $x_3 > 2$, and $x_4 > 2$. Then $x_1' = x_1 - 3$, $x_2' = x_2 - 3$, $x_3' = x_3 - 3$, and $x_4' = x_4 - 3$ are nonnegative integers. Substituting $x_1' + 3$ for $x_1$, $x_2' + 3$ for $x_2$, $x_3' + 3$ for $x_3$, and $x_4' + 3$ for $x_4$ in equation 1 yields
\begin{align*}
x_1' + 3 + x_2' + 3 + x_3' + 3 + x_4' + 3 + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 12\\
x_1' + x_2' + x_3' + x_4' + x_5 + x_6 + x_7 + x_8 + x_9 + x_{10} + x_{11} + x_{12} & = 0 \tag{5}
\end{align*}
Equation 5 is an equation in the nonnegative integers with one solution since all the variables must be equal to zero.
By symmetry, there are the same number of solutions for each of the $\binom{12}{4}$ ways we could violate four of the restrictions. Hence, we need to add
$$\binom{12}{4}$$
to the total.
Thus, by the Inclusion-Exclusion Principle, the number of admissible solutions is
$$\binom{23}{11} - \binom{12}{1}\binom{20}{11} + \binom{12}{2}\binom{17}{11} - \binom{12}{11}\binom{14}{11} + \binom{12}{4}\binom{11}{11}$$
For a more general approach, you can use generating functions. In this case, you want to find the coefficient of $x^{12}$ in the expansion of
$$(1 + x + x^2)^{12}$$
which takes some work.