Heart rate restrictions while exercising

Courtney
Hey ladies! 
Dos any of your Drs tell you not to get your heart rate over 140bpm when exercising? My dr did but I have seen various articles, such as the Mayo Clinic say that heart rate really doesn't matter and that you should just listen to your body.... 
I was very in shape before getting pregnant...weight training and cardio. I have been following the rules of the heart rate until tonight's spin class, where it was around 160bpm sometimes.... 
Thoughts on this topic anyone? :-)