A received word using this code will have $3^{5-2}=27$ cosets:
if no error has occurred, the coset leader is 00000;
if only one error has occurred, then the coset leader is one of the ten possible weight-1 error words, right?
So this leaves us with $16$ cosets remaining, corresponding to $2$$5\choose2$$=20$ possible weight-$2$ error words. In this case, how are the error words distributed among the different cosets? Some cosets will clearly contain just one error word, implying that this code can correct some two-bit errors. Which contradicts the theorem saying that a code of minimum distance 4 (this one) can correct up to one error!! So where have I gone wrong?
There are a total of 40 vectors of weight two. Ten ways to select the two non-zero positions, and two non-zero values for both of the non-zero components. $$ 40={5\choose 2} (3-1)^2. $$