Specific selected object won't export to STL while others will
I've figured out the issue. My file -- and example file -- has two 3D-view panels open. Each of these permits layers to be selected as visible or not in the usual way. The main viewport has layers visible for my object (the example tetrahedron). However, a second split window, also set to 3D View, has only other layers selected to be visible -- the layer containing the tetrahedron is NOT set to visible in this other, minimized window.

It turns out that setting the tetrahedron's layer to visible in this second window suffices to make the object export properly. So it appears that the Export code is reading the layer visibility from one viewport (the most-recently-created one?), even if this is not the main viewport.

Here is a clearer example of a situation in which the selected object will not export. Note that the lower window (now not minimized) has a layer not containing the target object selected for visibility.



A hint about this came from an answer to another question (STL empty on export (Python API), answer by Azukikuru) which refers to visibility. Visibility turned out to be the key here.