Yes, this is the reason you should use 'early stopping' in your models which will stop training when the model is not improving or you can keep the history of the training to pick the epoch that had the best performance.
The reason you get excellent results in the 12th epoch, but terrible performance in the 100th epoch is simply you are overtraining. By overtraining, you are causing overfitting, and the model is not able to generalize, instead, it imitates your data. Thus, the model will have high accuracy in in-sample data but comparably bad in out-of-sample data when you train a lot.
Moreover, take into account that unnecessarily complex and poorly regularized models are likely to overfit also. Especially, when the input data size is small. But in any case, if you lose performance as you train the model, this is probably because of overtraining.
For this reason, try to always have a graph of training accuracy vs test accuracy (or validation accuracy) by epoch. Thus, you can observe where (in which epochs) train and test accuracy move together. Where your train accuracy is >> test (or validation) accuracy then there happens overfitting, and where your test (or validation) accuracy is >> train accuracy then you are underfitting there.