If there is a sour taste in your teeth it could be due to pH imbalance. When you are suffering from acidity, there is a sour taste in the mouth as a result of which the pH is acidic and the teeth are likely to be eroded.
You could have a cavity which has trapped food and it has gone bad. It could be a food you have eaten that has left an after-taste. It could also be acid reflux from your stomach