Hearts gave themselves a great chance of reaching the group stages of the UEFA Cup thanks to a last-minute strike by Patrick Kisnorbo at Murrayfield.
The Australian could not have picked a better time to score his first goal for the club.
The Edinburgh side - playing at the home of Scottish rugby as their own stadium fell short of UEFA standards - led through goals from Andy Webster and Paul Hartley.
But Paulo Almedia Santos took advantage of a lack of carelessness in the home defence to score an away goal before Kisnorbo had the final say.
Hearts' injury problems were such that midfielder Phil Stamp was deployed in a striking role alongside Mark De Vries, with Graham Weir ruled out with mumps.
The kick-off was held up for several minutes with Bulgarian referee Anton Genov ensuring the goal-nets were properly secured before allowing the game to go ahead.
Hearts opened brightly and when De Vries chested a Joe Hamill cross into the path of Jamie McAllister, the midfield player's shot from just outside the area whistled narrowly wide of Paulo Santos' left-hand post.
McAllister had another shooting opportunity shortly afterwards but dragged his shot well wide.
Hearts played a patient game and Braga seemed content to defend in depth and hit on the break.
Hartley wasted a good opening when he ran from deep inside his own half to the edge of the penalty area, but played his final pass on the wrong side of De Vries.
Hearts almost snatched the lead nine minutes from the break when De Vries picked out Stamp and his first-time effort brought a superb one-handed save from the alert Santos.
Braga's response was immediate. A Wenderson Said shot took a wicked deflection off Webster and Craig Gordon reacted swiftly to push the ball away for a fine reaction save.
Hartley kept Santos on his toes in the final moments of the first half with a 16-yard shot which the goalkeeper dealt with extravagantly.
Hearts made the breakthrough six minutes into the second half when Hamill picked out De Vries at the back post and his header back across goal was headed in by Webster from four yards.
Stamp had a chance to double Hearts' lead nine minutes later when De Vries set him up but his 25-yard shot was marginally wide.
The goal was only delayed until the 62nd minute when Hartley played the ball wide to Robbie Neilson and then took the return pass in his stride to beat Santos with a left-foot volley.
But Paulo Sergio pulled back a precious away goal for the Portuguese two minutes later when he timed his run to perfection to head home a Said free-kick.
Kisnorbo then put a gloss on the final scoreline when he thumped home a right-foot shot from a Hartley corner.
Craig Gordon - 5 - pretty poor night, didnt look convincing at all
Alan Maybury - 6 - put in a good shift, MUST play on right though
Robbie Neilson - 7 - didnt put a foot wrong. long throw ins a REAL advantage
Steven Pressley - 8 - started off slack tonight, handled eveything once got into rythmn
Andy Webster - 8 - again same as big Elvis, and a good goal
Joe Hamill - 6 - drifted in and out of the game, needs more consistancy although he had a hand in the first two goals.
Jamie McAllistair - 7 - excellent, his natural left - sideness, is a big assest
Paul Hartley - 8 - great game, challenged everything and great volley
Patrick Kisnorbo - 5 - quite poor, lots of running, not much else, gives ball away too much although scored a vital third.
Phil Stamp - 7 - STUPID foul for Braga goal, but done well up front, good shot on goal.
Mark de Vries - 7 - done a power of work and challenged all night, tired towards the end
Subs
Neil MacFarlane - 8 - Why does he not get a game? Totally committed, good passer and much better than Paddy I think
Dennis Wyness - 7 - should have started I think, done well when he came on - really unlucky with his effor that just went wide
Ref
10 - EXCELLENT - fair and didnt get fooled by Braga (esp. the keeper) diving