Other answers surely are advanced, but it may be a good idea to remind explicitly that class number is exactly the quantitative measure of the failure of unique factorization: by its definition it measures "how many more ideas are there compared to numbers".
That is, decomposition is always unique for ideals, so if all ideals you have are numbers (class number = 1), then you don't have any problem decomposing numbers (PID). Further, the more "leftover" ideals you have, the more possibilities of writing different decompositions of numbers there are.
This vague statement can be turned into some precise ones. If you have different factorizations, this means the prime ideals in the decomposition $\mathfrak p_1\mathfrak p_2\dots\mathfrak p_n$ are grouped in a different way. I think you can establish from here that the number of possible factorizations is no more than $C(h)$, where $h$ is the class number.
Another precise statement that easily folows, already mentioned, is that $x^h$ must always have a decomposition into true numbers rather then ideals (indeed, it is $\mathfrak p_1^h\mathfrak p_2^h\dots\mathfrak p_n^h$).