Omigod, omigod, I just had a realisation.
In Our Man Bashir, Garak sneaks in to Julian's James Bond holoprogram, and finds out it's about spies and secret agents, and is obviously curious about it. "It looks like I joined the wrong intelligence service." Definitely shows some amusement if nothing else.
So, later on, they've been chained to the laser, Garak snarks at Julian hitting on Jadzia's image (Poor guy, watching his crush hit on the appearance of his friend he was attracted to when they first met), and Julian gets the key from her, unlocks them both, and they run away with seconds to spare.
They're running through the caves, there's rocks falling, the ground is shaking, and they have trouble standing at times.
Then Garak decides he can't do this, and tries to leave, which could destabilise the program, and possibly lose the senior staff's images, leaving them no bodies to be transported back into. Julian shoots him, and Garak changes his mind.
We're going to jump ahead into Season 5 here, and the episode 'By Inferno's Light'.
"Besides, this isn't like Tzenketh. The walls won't collapse in on you."
That's something Garak says to himself while in the crawlspace, talking himself down from a panic attack.
They're in a cave, during what's basically an earthquake, there are rocks falling, and the safety's are off.
Garak has claustrophobia, and experienced walls literally collapsing on him.
He's having a freaking panic attack, and his instinct is to get the hell out of there, saving the senior staff be damned. He lashes out at Julian, goes to call for the exit...
And Julian shoots him.
Now, I have panic attacks, so I can tell you, pain can be a great way to snap you out of them. And I'm going to assume being shot in the neck by your best friend you have a massive crush on is enough of a pain blast and shock to snap you out of a panic attack.
Which explains his change of tune, actually. Also, Garak is impressed that Julian kept a level head (And it's even mentioned in ASIT), so he's going to help.
TL;DR Garak had a panic attack because he's in a cave of falling rocks, and has a history of claustrophobia and being trapped under falling debris. Julian shooting him snapped him out of it.