Truck stalled

Hi, I was leaving a friends house in my '05 Colorado with 153000 kms and had driven just a few blocks when someone pulled in front of me so I braked, as I was stepping on the gas again my truck just wouldnt go, the engine wouldnt rev or anything. All the lights and everything were still on but nothing was happenening. I put it in park and turned it off gave it a couple of minutes then started it back up again and it drove the rest of the way home with no problem. This is the first time something like that has happened. The battery light and the check engine light (which has been on since our last oil change) came on when it died but nothing else happened. Please let me know what you think it may be before I spend thousands at a mechanic. I really really appreciate it!