Trials and Tribble-ations, no contest.
IaMD is second, but I'd say there's a margin between them.
Relics is third by a larger margin.
Flashback was complete pony.
Okay, Relics had Scotty in the story, (which was cool) and recreated the bridge of the 1701 (which was also cool), but IaMD went further in its recreations of TOS (FOOD CUBES!) but T&T wins for the fact that they went back into an old episode
. that's just too cool for school.
Flashback was dreck because while they had a hallucinatory trip back in time, a) it was a f*#%ing HALLUCINATION! and b) they got stuff wrong like killing of Valtane despite the fact that he's quite bloody clearly alive at the end of TUC on the sodding bridge of the Excelsior! oh, and c) it was the Movie Era, not TOS.