The use of 一 here means "as soon as" or "just as" and it can be used in quite a few ways. The 一 is similar to 一下子 so it is also pointing to "just in that instant", there is something immediate to it.
The thing that the Chinese speaker was trying to explain, I think, is that the phrase also points to the fact that in the case where the phrase is 一不小心 that they were trying their best to be careful (小心) but in the instant that it happened there was a consequence.
This is different from just being careless, someone 一不小心 might be sweating from trying hard to avoid something, but someone careless could knock over a glass of milk. I think in the case of the glass and being careless you could use 一不当心 rather than 一不小心. With 一不当心 being "in a moment of carelessness" rather than as a result of someone trying to be careful (小心).
Here are some examples of the use of 一 with a similar meaning:
- 我一看到他 (As soon as I saw him）
- 我一碰到他 （As soon as I touched it)
- 我一想到他 (Whenever I think of him or as soon as I think of him)
- 我一下班回家 (As soon as I finish work and return home)