this has happened to me too, the brake and the battery sometimes flash on and off, usually when i'm slowing down under 20k's, and even randomly while driving.
today my brake llight was constantly on on the way home, and flicked off when i parked the car

my parents camry had this happening at random (just the battery light not the brake light)
it turned out to be a worn out regulator in the alternator... they had it replaced about 2 years ago and it was fine until about a week ago, its just started flashing on and off at random again.
as far as the brake light, check the fluid level first like pringles said as its the easiest thing to check...
if the fluid is low it could be all sloshing to one side in the reservoir when you corner exposing the sensor which would cause the light to come on each time you go around a corner.