The first flight of the PV-2 Harpoon occurred on December 3, 1943. However, early flight tests showed a tendency for the wings to wrinkle, so Lockheed opted for a wing redesign rather than a slight six foot wing reduction for making the wing uniformly flexible. The first 30 PV-2s delivered to the US Navy in 1944 which had the original defective wings were relegated to training duties with the outer wing tanks sealed off and designated PV-2C, and because of the redesign of the Harpoon's wing, only 69 PV-2s had been delivered by the end of 1944. When the wing problems were remedied, the PV-2 entered service in February 1945, and it began operational deployment from the Aleutian Islands the next month. Even before the PV-2 had entered service, the Navy placed additional orders for 908 more PV-2s (BuNos 37535/37634, 84057/84589, 102001/102275), which were equipped with eight 0.50-inch forward-firing machine guns and hence received the designation PV-2D. (In an interesting footnote, one PV-1 Ventura with the BuNo 34986 was modified with the PV-2 tail empennage and unofficially became known as the "PV-1 1/2", with the Lockheed Vega designation V-153 applied to this conversion.) In April-May 1945 the Harpoon made its combat debut when it launched rocket attacks on the Japanese-held Kuril Islands, and it also hunted Japanese submarines and shipping in the vicinity of island chains in the Western Pacific during the summer of 1945. The combat career of the Harpoon was rather brief, and by time Japan surrendered, only 35 PV-2Ds (BuNos 37535/37550, 37624/37634, and 84057/84064) had been delivered, after which the remaining PV-2Ds on order were canceled after V-J Day and by which time a total of 535 PV-2s had been built. A handful of PV-2s and PV-2Ds in service were also modified into crew trainers and redesignated PV-2T. The US Navy continued operating the Harpoon for a few more years (the Naval Reserve had eleven of its patrol squadrons equipped with the PV-2 at one time) until August 1948, when it retired the Harpoon fleet. Several PV-2s which were declared surplus to Navy requirements after World War II ended up on the commercial market, with some being modified as private transports with deluxe interiors and a few others converted to agricultural spraying aircraft.
Shortly before World War II ended, the Brazilian Air Force became the first foreign user of the PV-2 when it acquired six aircraft, erroneously designating them B-34A, and these aircraft served with Brazil (some of them modified as transports) in service until the 1950s. In 1945, the Royal New Zealand Air Force (RNZAF) ordered 48 PV-2s to replace its PV-1s, and the first four were delivered in February 1945, but problems with these planes were encountered and further deliveries were cancelled, leading to the RNZAF returning these PV-2s to the US Navy in late April-mid May 1945. During the 1950s, a number of countries acquired numerous ex-US Navy Harpoons, including France, Italy, Japan, Peru, Netherlands, and Portugal (some PV-2s which served with Portugal were previously in French and Dutch service). The Aeronautica Militare Italiana withdrew its PV-2s from service in the late 1950s as it began acquiring the Grumman S2F Tracker, and the Royal Dutch Navy sold its PV-2s to Portugal in 1953 as it took deliveries of the P2V Neptune, while Peru operated the Harpoon until the 1960s. The Portuguese Air Force used some PV-2s for counter-insurgency missions against Angolan independence fighters in the 1960s during Angola's 1961-1974 war for independence from Portugal, and the Harpoon was retired from Portuguese service in the early 1970s by the time Angola became independent in 1975.
As a side note, in 1943 Lockheed Vega proposed a development of the Harpoon featuring modified armament, strengthened undercarriage, and "C Series" R-2800 Double Wasp engines, designated V-154 by the company and unofficially called "PV-4". However, the "PV-4" proceeded no further than the design phase.
References:
Buttler, T., and Griffith, A., 2015. American Secret Projects 1: Fighters, Bombers, and Attack Aircraft, 1937 to 1945. Manchester, UK: Crecy Publishing.
Marson, P.J., 2001. The Lockheed Twins. Tonbridge, UK: Air-Britain Historians Ltd.