You do not need the "a" after the ".ui-accordion-header" in the selector.
It should read:
$('a:not(.ui-accordion-header)')
If you place the following "a" the selector searches for all "a" children of elements with the class ".ui-accordion-header", but that style is applied to the anchor element, not its wrapper.
After looking back at your question I realize that based on your note that the css selector applies that style to the header my solution my not work for you.
If you could post the output of the accordion widget for one of the panels and the code that generates it, it would be helpful in diagnosing your problem.
I tried both your examples and $(‘a:not(.ui-accordion-header a)’).
They all work fine according to fire-bug, but in reality they do not work:
The debugger indicates that this statement only executes for links that are not in .ui-accordion-header - which is exactly right.
But still the loading.gif also appears when clicking on the link in .ui-accordion-header - even though the statement’s breakpoint did not cause fire-bug to halt (statement was not executed by fire-bug).
If I comment out the statement, then no loading.gif appears for all links. So there is no other statement somewhere else causing this behaviour.
The only guess that I would have as to why it works correctly after page load (i.e. in the debugger) but not normally is that the UI styles have not yet been applied to the elements when you are calling the selector.
However, I abandoned this mission, since my statement simply selects too much other unwanted links on the page as well. So I was forced to be more precise and had to rather stipulate the individual links I wanted to be selected. I gave them all a separate css class.