I had this same shifting issue for the past year or so, it was driving me nuts!
It finally got to the point where the brake lights wouldn't work, even if I could shift the car out of park. Turns out, its a little switch under the dash that goes bad. This switch is set up to sense the brake pedal position, which is essential for both the park shift interlock as well as brake light application.
This is apparently a pretty common problem. I have an 08 aveo, and the NHTSA TSB number for that year for this problem is 10027913.
I had a local mechanic replace the switch, only took an hr and a half, and about $60. The dealership wanted to charge me about $120, but since I have an extended warranty it would only have been $100 deductible. Still, the local guy was cheaper, so I went with him. Ironically, same local guy is quoting me more $$ to replace my timing belt vs. the dealership. So the dealer will still get some of my business.