Substitute Brett Pitman's late equaliser against Derby failed to prevent Bristol City slipping into the bottom three.
Craig Bryson's fifth goal of the season put the Rams ahead following a cross by Jeff Hendrick.
Steve Davies was denied from making it 2-0 by the post before City, without a win in five, equalised near the end.
Albert Adomah cut the ball back for Pitman to curl into the top corner from 20 yards.
City still have to face promotion-chasing Birmingham and West Ham, but manager Derek McInnes will be confident his side can stay up after a battling performance.
They started well against Derby but were left chasing the game when Bryson produced a clinical side-foot finish after fine work from Hendrick in the 20th minute.
Adomah spurned a glorious chance to equalise when he nodded over from six yards but Derby were denied from doubling their lead when Davies found space in the box to rattle a post from a narrow angle.
And City made the most of their good fortune to level in the 74th minute.
Adomah slipped the ball to substitute Pitman 20 yards out and the striker fired a superb right-footed finish into the net.
City goalkeeper Dean Gerken produced a good save to deny Hendrick with time running out, and it proved crucial as the home side held out for a point.