Were you trying to set up a build que for a bunch of other units? I have noticed that if I have my mouse pointer over a unit in the city screen then use the middle mouse wheel to scroll down to another unit etc... and then I click on the unit I want to build the first unit that I had the mouse over is the one actually getting clicked, not the one I want to build.
Example: I want to build a bunch of missionaries of religion X. They just happen to be the second unit from the left on te second row of units in the city screen. If I have my mouse over the 2nd unit form the left on the first row (usually because I just qued up a missionary in this example, and when you click on it ot que it up, it automatically jumps back up to the first row), and then use the scroll wheel to move down a row (thus never moving the mouse) the game thinks I am still on the unit in the 1st row, while I think that I am on the missionary.
The only way to prevent this is to actually move the mouse pointer either off the units completely, or to move it over another unit, and then back to the unit I want to que up.