Ireland has scraped past Wales 27-17 in Dublin and stayed in the Six Nations title race for at least 24 hours.