I've normally never gotten this wrong, however I did have a couple of stand outs:
Bought a Rock Springs in 2009 and was told I needed the medium and not a large. The bike was actually amazing, it felt like a big BMX and turned Welsh rocky descents into an arcade game. I felt invincible on that bike. However, the top tube was too short and I kept hitting my knees on the bars on steep climbs, I just couldn't get the damn thing to hold any momentum going uphill.
So I gave the frame to my missus and bought a Wolf Ridge in a large. I took it away to the Peaks the very weekend I bought it and didn't get on with it at all...there was marginal extra length in the top tube and the frame was far too tall and lanky - the reverse of what I'd hoped for. I eventually fitted a set of Wotans to it and I wound up with a bike that felt nervous, twitchy and lacked feedback at the front end and was spitty and bob prone at the rear no matter how I tuned the shock.
It has a happy ending though. I swapped the oil in the fork to a slightly heavier weight, which gave more support and enabled me to run less air pressure, when accompanied with a soft compound front tyre made the bike feel grippy and communicative at last. The high top tube means that I have to run the bars higher than ideal as I'd end up smacking the shifters and brakes on the tube, but it's splitting hairs really.
Instead of sinking a pile of cash into an El Guapo, I swapped the shock for a Kashima CTD which has transformed it. It's no longer spitty or wallowy and the rear end feels absolutely nailed down despite me running lower pressures in the shock can. The Stinger chain guide has helped with the pedal bob too so the bike is pretty much how I'd originally envisaged. It's also become a very decent climber along the way too.
The moral of my story is to always borrow a test ride for the weekend before you buy and to never take the advice of a bike shop as gospel.