Robbie Neilson breathed new life into Hearts' UEFA Cup campaign with a late strike in Basel.
Neilson picked the perfect moment to score his first goal for the club with just two minutes left to give Hearts a famous European result.
Basel had looked like taking at least a point through a 77th-minute goal from substitute Cesar Carignano.
The Edinburgh side had led through a disputed first-half goal from Dennis Wyness before the Argentinian had his say.
John Robertson's side battled well throughout but had to rely on some excellent goalkeeping from Craig Gordon at times.
Hearts were without suspended duo Patrick Kisnorbo and Paul Hartley but captain Steven Pressley was passed fit to play after a virus.
The Jam Tarts found themselves under early pressure with Banjamin Huggel seeing a header deflected wide and then Boris Smiljanic also going close.
Gordon had to move swiftly to smother a shot from Matias Delgado after good work from Julio Rossi.
The goalkeeper did well in the 17th minute to get to another Delgado shot and Rossi's follow-up header lacked the power to further trouble Gordon.
Wyness should have opened the scoring nine minutes later when a Basel clearance broke to Michael Stewart off referee Kristinn Jakobsson and he set up the striker who pulled his shot inches wide.
Joe Hamill then shot just wide with a 20-yard effort but Basel did not heed the warning as they fell behind after 31 minutes.
Ramon Pereira set up Wyness who shot through a packed penalty area beyond Pascal Zuberbuhler but Basel were unhappy that Pereira looked to be in an offside position when the ball went in.
The Swiss side came back with Gordon blocking a Philipp Degen shot and then Mr Jakobsson waved away penalty claims after Alan Maybury had challenged Mile Sterjovski in the area.
Sterjovski was wild with a shot as half-time approached after great work from Christian Gimenez.
It took a superb save from Gordon ten minutes into the second half to keep Hearts in front when Scott Chipperfield met a Smiljanic cross with his head but the goalkeeper's reflexes were up to the task.
But Basel were becoming increasingly frustrated at their failure to consistently threaten a Hearts defence which was well-marshalled by Pressley.
Andy Webster managed to threaten at the other end with a header but Zuberbuhler saved comfortably.
Carignano almost snatched an equaliser with a 75th-minute header that beat Gordon but Maybury scrambled the ball off the line.
But the Argentinian finally broke Hearts two minutes later when he struck a brilliant individual goal, shooting into the top corner of the net.
But Neilson had the final say after Phil Stamp had headed a cross from Hamill into his path.