Stephen Jones looked to have stolen a precious first victory of the tournament with an injury-time drop goal that gave Wales a 24-22 lead.
But that was to be surpassed just seconds later when Ireland's Ronan O'Gara responded with a drop-goal of his own to clinch the win for the visitors.
"I'm happy because the boys put in a good performance but obviously I am also very disappointed because at the end of the day we lost," said Hansen.
"The boys have taken a lot of flack during the tournament, sometimes it's justified and sometimes not, but they have really been working hard and just haven't been getting their deserts.
"The main thing we must learn from the game is that you have to compete not just for 80 minutes but for 85. But full credit to Ireland for the way they came back at the end.
"Perhaps the most pleasing thing was that the boys did not lose their composure when we went 19-7 down.
"Against Scotland we lost our concentration and paid too much attention to the scoreboard, but this time we kept our heads and got right back in it.
"That was very satisfying and a sign that this young team is maturing at Test rugby."
Skipper Jonathan Humphreys may miss the final game of the tournament.
The veteran Bath hooker, who won his 35th cap against Ireland, was replaced during the second half after suffering a recurrence of the shoulder injury that forced him out of the trip to Edinburgh.
A downbeat Humphreys said: "I've injured the same area as a couple of weeks ago but hopefully not as badly, we will have to wait and see."
Man-of-the-match Stephen Jones, who nearly won the match for Wales with an injury time drop goal said: "We are all very disappointed because it was a game we could have one. But we played some good rugby, and have to look at the positives. Hats off to O'Gara, when it mattered, he came up with the goods."
Ireland captain Brian O'Driscoll said: "He (O'Gara) showed real character to come off the bench cold and do what he did.
"Once he struck the ball, I think everyone in the team was willing the ball over. It took such a long time to drop and you can say that I was rather relieved.