It helps if you label the coins, but you don't have to. Take 8 of the 12 coins and put 4 on each side of the scale. Either one side will be heavier, or they will balance even. If one side is heavier, take 3 coins from the heavier side and remove them. Put 3 coins from the lighter side on the heavier side and replace them with 3 of the unweighed coins.
If the heavier side is still heavier, then either the original coin on the heavier side is heavier or the original coin on the lighter side is lighter. Balance them against each other to find out.
If the side that was originally heavier is now lighter, that means that one of the 3 coins that was moved from the lighter side was the light coin. Weigh two of them against each other. Whichever is lighter is the coin; if they balance, the odd coin out is the light one.
Finally, if the sides balance, then you know that one of the 3 coins from the originally heavy side is the heavy coin. Do the same as above.
Now, if you do the original weighing and they balance, then you can take all 8 of them off the balance. Take 3 of the unweighed coins and put them on one side, then take 3 of the coins you know are identical and put them on the other side. If it balances, then you know the remaining coin is light or heavy. Weigh it against one of the identical coins to find out which.
If it doesn't balance, then you know that one of those 3 coins is either heavy or light. Weigh two against each other. If they balance, then the third is either heavy or light (obviously if the 3 coins were heavy, then it's heavy; vice versa for light). If they don't balance, then you know the one that goes the same way as the 3 coins is the odd one out and is either heavy or light (if the 3 coins were heavier, then it is heavy; if the 3 coins were lighter, then it's light).
The formula for the maximum number of coins you can do this for using n weighings when you only know that one is different is (3^n - 1)/2. For 3 weighings, that gives us 13 coins, so 12 should work. Though it's not guaranteed.
Alternatively, the formula for how many weighings it will take for n number of coins is log_3(2*n + 1), which gives us 2.9 ~= 3.