OK, I figured it out. It was because I was including wp-config.php instead of wp-blog-header.php; I did that because wp-blog-header seemed like it was set up to only work in the same directory as the rest of the WP stuff. But I guess that’s not really true.
What it boiled down to was the variable post_meta_cache wasn’t getting set up.