The Swiss outfit took a 12th-minute lead through Alexander Frei before Marco Borriello restored parity nine minutes later.
Samuel Inkoom edged the visitors back in front before half-time while Roma midfielder Rodrigo Taddei was unlucky not to equalise in the 58th minute when his effort rebounded off a post.
But deep in stoppage time, substitute Adilson Cabral put the game beyond Roma's reach to cap a wonderful night for the visitors.
The result saw the Swiss club climb to third place, level on three points with Cluj and Roma after three games played.
Bayern Munich beat Cluj 3-2 in the other group game to maintain their 100% record.
Basle had suffered consecutive defeats so far in the group stage but they took an early lead with Frey finding Marco Streller's pass and striking the ball with his left foot from the edge of the area past Roma goalkeeper Bogdan Lobont.
It was not long before Roma had pulled level.
Francesco Totti fed Borriello inside the area and he fired past goalkeeper Francesco Costanzo.
In the 37th minute, Totti, looking for his first goal of the season, struck just wide of the far post.
Two minutes later, Frei had a goal disallowed for offside as Basle threatened and the visitors eventually went back in front when Xherdan Shaquiri's pass found Inkoom inside the area and his diagonal effort beat Lobont.
Roma twice had the chance to equalise after the re-start but Totti and Borriello's efforts from long range went wide.
Taddei struck the post before the hour and Borriello then forced Costanzo to make a fine save from eight yards.
Benjamin Huggel should have increased his team's advantage in the 76th minute but his powerful header from Frei's cross went wide.
Roma pressed forward in search of the equaliser and they almost succeeded with five minutes remaining when Philippe Mexes latched onto Totti's cross only for his effort to go over the bar.
Basle had the last say with Cabral latching on to Scott Chipperfield's pass before driving the ball past Lobont.