In the greater scheme of things, the consolation result didn’t mean much as the Italians still took top spot in Group H after Manchester United lost by the same scoreline to Valencia.
But the victory meant a plenty to the Swiss champions as they proved too hot to handle for the Cristiano Ronaldo-led Italians who suffered their first away defeat this season in freezing temperatures in Bern.
Swiss daily NZZ called the game 'The 'Miracle of Bern' – a reference to West Germany’s far-more famous 3-2 victory over favourites Hungary in the World Cup final played in the Swiss capital in 1954.
Meanwhile, local daily Berner Zeitung said “the best had come at the end” in the match.
France forward Hoarau slotted in the first after half an hour from the spot at the Stade de Suisse blasting in the second after 68 minutes to lift spirits of his already eliminated side who finish bottom of the group.
Paulo Dybala -- who scored a hat-trick in the 3-0 home game in Turin -- came off the bench just after the second goal and pulled one back for Massimiliano Allegri's side ten minutes from time and had a second disallowed in injury time.
Juventus finish top of Group H on 12 points with United on ten, Valencia on eight and Young Boys with four.
"We achieved our objective by winning the group, even on a night where everything seemed to go wrong, maybe we weren't focused enough," said Allegri.
"We missed so many opportunities and gifted a penalty, so at the end of the day it was only right that we lost."
Ronaldo, the record scorer in the elite European competition with 120 goals, started the final group match despite Juventus already having secured a berth in the knock-out round as coach Massimiliano Allegri wanted to ensure his side avoided being drawn against Barcelona, Real Madrid, Manchester City or Paris Saint-Germain in the next round.
But veteran defender Giorgio Chiellini was rested ahead of next weekend's Turin derby in Serie A, as Allegri feared a potential injury on the artificial pitch in Switzerland.
Ronaldo had three chances to put Juventus on the scoreboard in the first half, but the visitors were impacted by Juan Cuadrado going off injured after twenty minutes with Alex Sandro coming off the bench.
Minutes later Brazilian Sandro conceded a penalty for bringing down Cameroonian midfielder Moumi Ngamaleu in the box.
Hoarau stepped up with Juventus goalkeeper Wojciech Szczesny at full stretch getting his fingers to the ball as it clipped the post and bounced back into the net.
The hosts came close to scoring a second just after the hour mark but Szczesny held Christian Fassnacht's header.
Hoarau again broke through after 68 minutes with Moumi Ngamaleu crossing to the French attacker who powered forward cutting past Leonardo Bonucci to beat Szczesny.
Dybala came on after 72 minutes in place of Mattia De Sciglio with Ronaldo setting up the Argentine to pull a goal back eight minutes later.
Two minutes into injury time Dybala thought he had bagged the equaliser with a volley but the goal was disallowed as Ronaldo was offside.
"I saw it, Ronaldo was in the path of the ball and the goal was offside," said Allegri.
"The important thing is that we won the group, even if its thanks to Valencia beating Manchester United," said Dybala.
"The defeat hurts, because we came here looking for the win, but it should serve as a lesson for the future."
It was the first away defeat for Juventus this season who have won seven times on the road in Serie A and twice in the Champions League.
Allegri's side had dropped points only in two home games -- a 1-1 draw against Genoa in Serie A and a 2-1 defeat against United in Champions League.
Juve face city rivals Torino on Saturday, looking to extend their eight-point lead in Serie A.