You either had something die or a die off of bacteria. That looks like you had a spike in ammonia. Hence the reason why your trites are 2 and your trates are 40. Being that it's only a 12g tank, if you had a good sized snail die, it could cause this. It could also be caused by algae dying...