I don't think it is an infection because it went away but still REALLY sore!
It is likely an infection, however you really should get an STD test done to make sure it isn't something more harmful!
An improper amount of lubrication, not washing genitals, and other things can promote infections.
Be sure to check with your gyno!