"The next thing I knew" or "The next thing I know" is a phrase that people use when they're telling a story. It's used when there is a blank period in your memory. For example, if you went to sleep or passed out, you can use "the next thing I knew":
I was riding in the back seat. I must have fallen asleep, because the next thing I knew, we were stopped at a rest stop and Celine was tapping me on the shoulder.
Eddie and I were doing tequila shots at the club. The next thing I knew, I was laying on Eddie's couch with a splitting headache.
You can also use "the next thing I know" if you decided to do something, but now you don't really remember why or how:
Jimmy and the boys called me from Las Vegas and told me to come down. So the next thing you know, I'm on a plane to Vegas, and all I've got with me is one change of clothes and a tooth brush.