The only solution that I know of is to host it all on the one box which makes it trick if you want to use Heroku to host your app.
I am currently wrestling with this problem as I want to host a new app on Heroku, but have the marketing side of the site powered by wordpress to take advantage of things like third party themes. The app will also generate linkable content, so it is important to me to have it on the same domain, but there seems to be no way to achieve what I want to do with heroku :-(
So annoying!
It was actually really easy with this: https://github.com/mhoofman/wordpress-heroku
But unfortuently, to the best of my knowledge, you can't host both PHP at the same time as Rails.
If anyone know otherwise I would love to hear!
I just read the DotCloud docs and they do a lot of stuff including php and ruby, you might want to check them out to see if they run both in the same instance.
I'll ckeckout DotCloud as well. Thanks for the heads up!
edit: added request for more info