I was connecting in LHR, (JFK-LHR-ZRH), about 2 years ago. I had a 10
gram tube (actually prescription ointment), which was not placed in the "baggie". LHR security caught this infraction: every single item in that carry-on was inspected and swabbed for explosives.

PS: TSA at JFK had no problem with my ointment.
If it was properly labeled as a prescription it shouldn't have mattered. Prescriptions are exempt from the 311 rule for the simple fact they're prescriptions. However when dealing with security you're not normally dealing with people that are highly motivated to know all the exceptions to the rules.