The first one depends on your criterion. Dr. Wayne is correct on the last locomotive produced for domestic use...the N&W shop built locomotives after the commercial builders had stopped.
The last commercially produced domestic locomotive was the NKP 779. There's a good story behind it too! It was after the railroad tried diesels, and then ordered 10 more 2-8-4s. She was built in 1949 by Lima-Hamilton. Ultimately, it was the rising price of spare parts (due to less efficient engines being retired) that undermined the mainline use of the Nickel Plate's Berks. While she was in service, a Lima historian (whom was a flagman for the NKP), John Keller, began plotting to bring the 779 home. John's leverage was that when the LE&W built there Sandusky to Peoria railroad, the promised the city of Lima to always maintain shop facilities in town. The NKP had hence inherited this promise, but didn't want to keep it since they didn't need the shops anymore. So John marched into the president of the railroads office, and arm twisted the 779 out of the president. (the 770-779 were parked before the S-2s like the 765 due to their maintenance interval coming up first) He then stashed her, along with his personal caboose (as a flagman) 1091 & business car #5 (obtained in paperless transactions with yard crews) in the Lima tank plant until the proper enclosure along the DT&I was completed in the early 1960s. She serves as an emergence organ donor to the 765 and previously the 759. On a least one occasion, a small accident occurred with the 765 right before an excursion, and an 11th hour parts swap with the 779 saved the day.
The transition to diesels was actually a rather slow deal, prior to the post-ww2 buying sprees. Outstanding designs like the NKP 2-8-4s were able to defeat diesels in head to head trials, but the real Achilles heal for steam came from the simple, poor designs that made up many railroad's rosters...rosters built around 2-8-2s, 4-6-2s, 2-10-0s, and other 1910's designed locomotives.
Once the writing was on the wall, it was kind of late for Baldwin, Alco, and Lima (the big three) to catch up. I'm probably going to mess this up, but I'll try it anyways...Alco's diesels were a partnership with GE. Baldwin's were a partnership with Westinghouse (iirc). Building steam locomotives is primarily work for a mechanical engineer, with the only electrical components being the generators...commonly on the left hand side of the boiler near the cab or behind the headlight...and only powered the cab lights, radio (if equipped), headlight, and mars light (if equipped). Diesels are a mix. They are essentially electric units with a diesel generator on board. The primary concern for an engineer isn't the RPMs, it is the current heading to the traction motors. Extensive electrical engineering required. Therefore, GE, Westinghouse, and EMD’s expertise was, in many respects, more applicable than Lima, Baldwin, and Alco’s. Lima merged with the Hamilton Machine Co to try to diversify by bringing in Hamilton’s industrial machinery business, and then they merged with Baldwin to try to survive…an odd paring…as Lima was the Cadillac of steam locomotives and Baldwin was the Chevrolet…different philosophies (ALCO was in between). Baldwin was done in by Westinghouse jumping ship, and Alco was done in by GE deciding to produce their own diesels.
The last steam in service is a tricky question. It depends on what you consider regular service. Many railroads kept an engine or two around into the 1960s. Some of the more famous were the CB&Q's 4960, UP's 844, the aforementioned 6000 (which most Ohio steam fans loved to go up and watch her fly at 70mph+), the CB&Q's 2-8-0 at Leadville, DM&IR 2-8-8-4s, and a few others. I regard the last as having been the D&RGW's narrow gauge circle. It was shut down in the late 1960's and was still entirely powered by 2-8-2s (and the well known 4-wheel diesel #50). This, depending on how you do the accounting, lasted longer than steam of BR. Again though, this isn't clean cut because the Rio Grande never stopped running steam on the Silverton branch, which morphed from a branchline into a tourist line, and was sold to investors whom still run it today...there locomotives are all 80+yrs old, and some passenger cars are 120+yrs old

.
Also, a lot of mainline steam went into backup service at the end. The railroads typically didn't purchase a whole lot of extra diesels, so the steam engines were kept around prevent shortages.
Typically, steam in the twilight was used on backwater lines (or in back up service) pulling freight or on special excursions. Railroads typically eliminated the steam engines from the passenger service first.
EDIT: I just remembered the Louisiana Eastern. The Louisiana Eastern is the stuff of legend. A railfan decided to purchase a bunch of steam at the twilight. I believe he owned a gravel pit or something. He amassed over 40 steam locomotives...and they weren't all porters. He purchased 3 Nickel Plate hudsons (2 Limas & 1 Alco)...as well as some 2-8-2s. Unfortunately, he died unexpectedly in the 1960s...and much of his collection went to the torch (including all three of his NKP 4-6-4s :cry: ). I can't recall were the survivors went, other than a 4-4-0 at Stone Mountain, GA.