Stochasticity, bistability and the wisdom of crowds: a model for associative learning in genetic regulatory networks