Reading snatched a late victory at Cardiff City as Yann Kermorgant's goal settled a scrappy encounter.