"We are happy, we are happy," Italy manager Roberto Mancini said after the game. "But after the group stage, it is a new competition.
"The guys are very clever. They want to win every game. They have a good mentality. We changed eight, but played a very good game.
"Wales is a good team, it was very difficult to win, but I think we deserved to win."
Pessina's goal came from a free kick conceded by Joe Allen on the far right edge of the penalty box on 39 minutes.
Marco Verratti, who won the free, delivered a cross into the box and Pessina guided it into the goal.
Wales improved in the second half but were dealt another blow when Ampadu was shown a straight red for a clumsy challenge on Federico Bernardeschi.
"The sending off changed the course of the game," Wales coach Rob Page said.
"I haven't seen it again yet. I thought it was harsh to get a booking but to see the red card come out was unbelievable. Then of course it's an even bigger hill to climb."
Gareth Bale had an excellent opportunity to level on 75 minutes when he volleyed a ball over the bar that he should have pointed into Italy's net.
Despite the loss, Wales join Italy as the two teams to progress from the group. Switzerland will have to wait to see if they are one of the top four third place finishers.
Switzerland beat Turkey 3-1 on Sunday but Wales' superior goal difference meant they secured second place.
"We knew it would be very difficult from the start," Bale said. "A lot of running and defending, I am proud of the boys.
"We have to recover now and take the break and get ready to get going again.
"With my chance I couldn't quite get over the ball, but it makes no difference in the end, we finish second."