I just ran into this problem when trying to use the Auto Update feature of Wordpress.
I could Ping from the server's terminal to downloads.wordpress.org
without problems, but the Wordpress app could not.
I resolved it by restarting the PHP service, it looks like it had stale DNS records and they've been changed at OS level by my VPS provider so a restart forced the update of them and got it to work.