Gloucester were denied a famous Heineken Cup win on French soil as a late Clement Poitrenaud try salvaged victory for Toulouse.
The visitors led 10-0 after Freddie Burns landed a penalty and converted a try from Charlie Sharples.
A Luke McAlister penalty and try from wing Timoci Matanavou reduced the gap before half-time, and two more McAlister penalties made it 14-10.
Henry Trinder's try put Gloucester 17-14 up before Poitrenaud pounced.
There was a hint of controversy about the winning score as the pass the full-back gathered from Matanavou appeared forward, although referee Peter Fitzgibbon ruled the ball had come back off a Gloucester hand.
If they were unfortunate in that instance, the visitors at least had the consolation of a losing bonus point from a performance full of endeavour and ambition.
Mike Tindall, axed from the England elite squad on Friday as punishment for his World Cup misdemeanours, enjoyed a strong game, having a hand in both Gloucester tries.
The Cherry and Whites won an early penalty at a scrum only for Burns to pull it wide of the posts.
But he got the first points on the board with a penalty after 11 minutes, and the fly-half's chip ahead almost brought further reward as the bounce deceived Poitrenaud, but the hosts snuffed out the danger.
When McAlister failed to find touch after refusing a penalty kick at goal, Gloucester again came close to scoring on the half-hour.
Trinder showed tremendous pace to chase his own kick to the line, only for Poitrenaud to flip the bouncing ball away into touch.
But two minutes later Gloucester got their reward after Toulouse failed to clear their lines from a 5m scrum, swift handling from Tindall, Trinder and Jonny May sending Sharples racing over.
Burns converted for a 10-0 lead, but Gloucester immediately allowed their hosts back into the game, McAlister landing a penalty before dabbing a beautifully weighted chip into the right corner for Matanavou to touch down.
Former All Black McAlister missed the conversion, but was on target with a simple penalty 11 minutes into the second half after Alasdair Strokosch was sin-binned for slapping the ball out of Matanavou's hands.
Burns missed a relatively straightforward opportunity to put Gloucester back in front minutes later, and Toulouse should have gone further ahead.
A rampaging burst from flanker Yannick Nyanga split the visitors' defence, but they wasted a huge overlap on the left when Yves Donguy dropped Poitrenaud's pass with the line gaping.
The hosts then had another try disallowed for a forward pass from Matanavou, and their frustration grew when Lionel Beauxis, on as a replacement for McAlister, sliced a drop-goal attempt wide from inside the Gloucester 22.
Beauxis was successful from the tee when Gloucester were penalised at a scrum, but the English side hit back swiftly.
Toulouse attempted to attack from deep but lost the ball 30m out, allowing Tindall to make a half-break and send Trinder bursting through to score, Burns converting to make it 17-14 with 10 minutes left.
But the four-time champions conjured a winning try two minutes later to the relief of the home crowd.
Gloucester head coach Bryan Redpath: "I am delighted with the performance. We came away with a point and we have to take the positives out of that.
"We had a man [Strokosch] in the bin and had to defend for 10 minutes with 14. We gave away a couple of scrum penalties, and you have to be very clean coming here.
"They are very small decisions we have to learn from, but the commitment was top drawer. I think we have gained a bit of belief from that performance."
Toulouse: C Poitrenaud; T Matanavou, Y David, F Fritz, Y Donguy; L McAlister, L Burgess; J Poux, G Botha, C Johnston, Y Maestri, R Millo-Chluski, Y Nyanga (capt), S Nicolas, S Sowerby.
Replacements: W Servat (for Botha, 52), G Galan (for Sowerby, 52), Y Jauzion (for Fritz, 60), L Beauxis (for McAlister, 60), Y Montes (for Poux, 64), J Falefa (for Johnston, 64). Not used: G Lamboley, N Vergallo.
Gloucester: J May; C Sharples, H Trinder, M Tindall, T Voyce; F Burns, R Lawson; N Wood, D Dawiduik, R Harden, W James, J Hamilton, P Buxton (capt), A Qera, A Strokosch.
Replacements: S Lawson (for Dawiduik, 55), Narraway (for Qera, 61), D Lewis (for Lawson, 70), D Chistolini (for Harden, 73). Not used: D Murphy, B Deacon, T Taylor, L Vainikolo.
Sin-bin: Strokosch (51-61)
Referee: Peter Fitzgibbon (Ireland)